4. Deconstructing Blink

4.2. Statements

We will now focus on two of the first lines of code: 

  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

The first line is obviously a comment.

The second line is not a comment, it is just code. It is the first statement of the sketch. A statement is like a sentence for the Arduino and it always ends with a ;.

This statement is commanding the Arduino to set the mode of the Built-in LED to output.

You may be wondering now why we had to do this in the first place, since we have mentioned that LEDs are outputs. This is because the build-in LED is connected to a specific digital input/output port, pin 13. When using any digital pin in a program, we need to declare it as input or output. More on this on the next module.


Function name
Inputs
pinMode ( LED_BUILTIN, OUTPUT
) ;