Home > Exploring Ideas, Hardware testing, Launchpad and Energia > LaunchPad and Energia ( StopWatch )

LaunchPad and Energia ( StopWatch )

This is a simple project using the LaunchPad from Texas Instruments and Energia (Arduino-like IDE).

The Launchpad version 1.5 comes with the MSP430G2553 microcontroller, it has a hardware UART (use the  jumpers as shown in the image).

This is a funny and very low cost project.
The LaunchPad measures time (in microseconds) .The car travels a fixed distance between contacts (10 Cms).

Time is measured using  START and STOP contact switches.
Contact switches are implemented using neodymium magnets.

You’ll need small nails, miniature neodymium magnets and colors headed pins to  assemble the switches.

Here is the code used:

/* Cronometer01.ino
  Arduining.com 25/AUG/12
  Used in the LaunchPad V-1.5 with the MSP430G2553
  Measuring time between the signals of START and STOP  in microseconds.
  The result is sent serial at 9600 bauds.
  
  GREEN LED on indicate READY TO START.
  RED LED on indicate MEASURING TIME.
  RED LED blinking indicate MEASURE DONE.
  
  Push RESET in the LaunchPad to repeat the measurement. 
 */
#define START  11     //Pin P2.3
#define STOP   12     //Pin P2.4

unsigned long time;

void setup() {
  pinMode(START,INPUT_PULLUP);  //internal pull-up
  pinMode(STOP,INPUT_PULLUP);   //internal pull-up
  pinMode(GREEN_LED, OUTPUT);     
  pinMode(RED_LED, OUTPUT);
  Serial.begin(9600);  
}

void loop() {
  Serial.println("READY");
  digitalWrite(GREEN_LED, HIGH);   // set the GREEN LED on
  digitalWrite(RED_LED, LOW);      // set the RED LED off

  while(!digitalRead(START)){}
  time = micros();
  digitalWrite(GREEN_LED, LOW);    // set the GREEN LED off
  digitalWrite(RED_LED, HIGH);     // set the RED LED on

  while(!digitalRead(STOP)){}  
  time = micros()-time;
  digitalWrite(RED_LED, LOW);      // set the RED LED off
  Serial.print(time);
  Serial.println(" Microseconds");

  while(1){                        // Blink to indicate END.
    delay(900);                    // wait 0.9 second
    digitalWrite(RED_LED, HIGH);   // set the RED LED on
    delay(100);                    // wait 0.1 second
    digitalWrite(RED_LED, LOW);    // set the RED LED off
  }

}

See it in YouTube:

Advertisements
  1. June 12, 2013 at 10:34 AM

    Hello from Energia Team,

    We would like to feature your project on our website http://www.energia.nu under “Projects using Energia” tab. Please get in touch with us at energia.nu@gmail.com. Looking forward to hearing back from you.

    Thanks,
    Energia Team

    • June 13, 2013 at 9:57 AM

      A separate mail was sent to you.
      Thanks for your great work.

  2. Eder Pico
    April 26, 2014 at 1:53 PM

    hello, this great work but my arduino program does not compile because the red and green pin are not defined, could help me with that?

  1. December 19, 2015 at 10:54 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: