Tools for programming

Our little computer has no keyboard and no screen. To program it, we use a more familiar form of computer -- your desktop or laptop computer.

While Texas Instruments provides a free complete professional software toolkit for programming the Launchpad, we will use a simpler program called Energia. It installs easily, and simplifies the process of writing and running programs for the Launchpad. Energia is also free.

You will find Energia here. On that page there are instructions for downloading and installing it on Windows, MAC, and Linux operating systems.

Once Energia has been installed on your machine, running the Energia program will bring up a window like the one above.

By copying the program below and pasting it into the empty Energia window, you can run your first program.

    pinMode( RED_LED, OUTPUT );     
  digitalWrite( RED_LED, HIGH );    // Turn the LED on
  delay( 100 );                     // Wait for a tenth of a second
  digitalWrite( RED_LED, LOW );     // Turn the LED off
  delay( 100 );                     // Wait for another tenth of a second

After pasting the program into the window, you can "Save as..." using the name "flash_led". The window will now look like this:

Energia screenshot

At the top of the window are five button icons. One has a checkmark. That button will cause Energia to check the program for errors. The next button has an arrow. That button will send the program to the Launchpad computer and start that program running.

Before we can run our program, we first need to connect the computer running Energia to our little Launchpad computer. This is easy -- we simply plug one end of the USB cable into the Launchpad, and the other end into the big computer. Since you loaded the drivers for the Launchpad when you installed Energia, your computer knows how to communicate with the little Launchpad computer.

There are only two things left to do to make our program work. First, we tell Energia which board we are using. The Tools menu has a Board item. We are using the msp430g2553 board.

Next, we tell Energia which communications port the Launchpad is connected to. It is probably the last port on the list in the Tools menu Serial Port menu item. If it isn't, Energia will complain and you can try the others in turn.

Now, at last, you can click on the Energia button that has the little arrow on it. That will send our program to the Launchpad and start it running. You should see the red LED on the board start to flash.

If you are using the Arduino, the instructions for downloading the software are here. The software works the same way as Energia, and has the same menus.