Numbers and constants

In our first program

we used the words RED_LED, OUTPUT, HIGH, and LOW.

These words are actually synonyms for numbers. The word HIGH is a synonym for 1, and LOW is a synonym for 0.

The word OUTPUT is a synonym for 1, and INPUT is a synonym for 0.

The word RED_LED is a synonym for 2. The word GREEN_LED is a synonym for 14.

We use these synonyms so we don't have to remember that the red LED on our Launchpad computer is connected to pin 2, and the green LED is connected to pin 14.

We can change our first program to use the green LED instead of the red one:

Simply change all three references to RED into references to GREEN, and then click on the button with the arrow. Now the green LED is flashing instead of the red one.

Our program also contains comments, so that the reader will understand what is going on. Comments start with two forward slashes, and Energia colors them green. The comments are just to help people read the code. The computer does not need them, and doesn't even really look at them, other than to skip over them to get to the next line of code.

Without comments and helpful synonyms, our code would look pretty bare and cryptic:

But it would still do the same thing -- blink the green LED five times per second.