Things used in this project

Code

Blink.inoC/C++
/*
  Blink
  The basic Energia example.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Change the LED define to blink other LEDs.
  
  Hardware Required:
  * LaunchPad with an LED
  
  This example code is in the public domain.
*/

// most launchpads have a red LED
#define LED RED_LED

//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
  
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}
BlinkGreenRed.inoC/C++
/*
  Blink
  The basic Energia example.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Change the LED define to blink other LEDs.
  
  Hardware Required:
  * LaunchPad with an LED
  
  This example code is in the public domain.
*/

// we will use the red and green LEDs, let's call them LED and LED2
#define LED RED_LED
#define LED2 GREEN_LED
  
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT); 
  pinMode(LED2, OUTPUT);  
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(LED, HIGH);   // turn the Red LED on (HIGH is the voltage level)
  digitalWrite(LED2, LOW);   // turn the Green LED off (LOW is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(LED, LOW);    // turn the Red LED off by making the voltage LOW
  digitalWrite(LED2, HIGH);   // turn the Green LED on by making the voltage HIGH
  delay(1000);               // wait for a second
}
Fade.inoC/C++
/*
  Fade
 
  This example shows how to fade an LED on pin 14
  using the analogWrite() function.
 
  Hardware Required:
  * MSP-EXP430G2 LaunchPad
  
  This example code is in the public domain.
 
*/

int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

void setup()  { 
  // declare pin 14 to be an output:
  pinMode(GREEN_LED, OUTPUT);
} 

void loop()  { 
  // set the brightness of pin 9:
  analogWrite(GREEN_LED, brightness);    

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade: 
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ; 
  }     
  // wait for 30 milliseconds to see the dimming effect    
  delay(30);                            
}
Button.inoC/C++
/*
  Button
 
 Turns on and off a light emitting diode(LED) connected to digital  
 pin 13, when pressing a pushbutton attached to pin 2. 
 
 
 The circuit:
 * LED attached from pin 13 to ground 
 * pushbutton attached to pin 2 from +5V
 * 10K resistor attached to pin 2 from ground
 
 * Note: on most Arduinos there is already an LED on the board
 attached to pin 13.
 
 
 created 2005
 by DojoDave <http://www.0j0.org>
 modified 30 Aug 2011
 by Tom Igoe
 modified Apr 27 2012
 by Robert Wessels
 
 This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/Button
 */

// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = PUSH2;     // the number of the pushbutton pin
const int ledPin =  GREEN_LED;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT_PULLUP);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}
DigitalReadSerial.inoC/C++
/*
  DigitalReadSerial with on-board Pushbutton
  Reads a digital input on pin 5, prints the result to the serial monitor 
 
  Harware Required:
  * MSP-EXP430G2 LaunchPad
  
  This example code is in the public domain.
 */

// digital pin 5 has a pushbutton attached to it. Give it a name:
int pushButton = 5;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600); // msp430g2231 must use 4800
  // make the on-board pushbutton's pin an input pullup:
  pinMode(pushButton, INPUT_PULLUP);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  Serial.println(buttonState);
  delay(1);        // delay in between reads for stability
}

Credits

Af672c156692b3c6720821ffddfff56a
Mark Easley

Texas Instruments LaunchPad SW Engineer

Contact
10384512 10105541378165610 2876926985073736385 n
Adrian Fernandez

peek a boo my name is adrian

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

E-Ink Display based Static Desktop eCalendar
Easy
  • 8
  • 2

Full instructions

An electronic Desktop Calendar based on Electronic Ink Display controlled by TM4C123 Tiva(ARM) development board & programmed in Energia IDE

MSP432 Fun with IoT Workshop 2016
Easy
  • 3,536
  • 69

Full instructions

Explore the Educational BoosterPack paired with the MSP432 LaunchPad and then take that to the cloud with the CC3100 Wi-Fi BoosterPack!

MIT IAP 2016 Lab
Easy
  • 2,021
  • 47

A collection of the 6 labs for the MIT IAP Texas Instruments LaunchPad Workshop

Texas Instruments MSP-EXP432 - MultiTasking
Easy
  • 708
  • 20

Protip

MultiTasking ultrasonic and color sensor with Texas Instruments MSP-EXP432 and Energia.

Control a CC3200 LaunchPad with your phone using Blynk
Easy
  • 6,345
  • 28

Full instructions

Read sensor data and toggle LEDs with the Blynk mobile app and the TI CC3200 LaunchPad

Mongoose Embedded Networking Library on mbed+CC3100
Easy
  • 651
  • 12

Protip

Mongoose, the most popular open source embedded web server and networking library now supports the mbed platform. See CC3100 example.

Add projectSign up / Login