Arduino Project #0. The Project that Does Nothing

Yes, it is true. Our first project is something that does nothing. However, this is the foundation of Arduino programming so please do not skip this lesson.

Components and Materials:

  • Arduino Board
  • Computer with Arduino IDE installed

Circuit

Simply connect the Arduino Board to the computer and we are ready to go.

The Arduino IDE

Before we head on to our project, here are some basic things to know:

  • Arduino Programs are referred to as sketches
  • Arduino uses C++ as its programming language

In addition to those two points, the picture below shows the different parts of the Arduino IDE

You will be able to master the use of this IDE as we go along with our tutorials. There is no need to memorize the parts, of course.

The Sketch

The sketch above is an example code from the Arduino IDE that can be opened thru File > Examples > 01.Basics > BareMinimum.

As the name implies, the sketch above is the bare minimum of an Arduino program.

Notice that there are two methods in the program: the setup() method and the loop() method.

setup()

The setup() function is run once each time the sketch is started. We can use it to initialize variables, assign pin modes, call some libraries, and a lot more.

loop()

The loop() function gets called after the setup() has been executed. Like what its name implies, the commands inside the loop() run forever.

//

You might have noticed the slashes in lines number 2 and 7 of the sketch. Any line preceded by those two forward slashes is treated by the compiler as comments and therefore will not be executed. Comments are useful for improving the readability of the program. Programmers can also use it to add notes for themselves or other programmers who are working on the same project.

Program Execution

In order to run a program, some important things must be done first.

  1. Choose the Arduino board that you are using by clicking on Tools > Board and selecting the board you are using.
  2. Select the port where the board is connected by Tools > Board and select the line where Arduino is connected.
  3. Click on Verify button to let the debugger check your sketch.
  4. If the debugger finds no error in the code, click on compile and upload sketch button.

If you have done everything correctly, the IDE will show a message “Done Uploading”. Give yourself a tap in the back because you have just run your first Arduino program.

As said earlier though, you will not get any response from the Arduino because this program is what its name says: BareMinimum.

Nothing to worry about, you will be able to use the things you learned here in the following projects.