Tag Archives: Tutorials

Arduino Tutorial 13: Understanding Arduino If Statements

In many real world applications, you want your programs to branch into different directions depending on values that you are reading from sensors. For such cases, you need to us IF statements. IF statements allow you to do different things depending on conditions. This lesson shows you how to use IF statements, and the different conditions that can be used with these commands. If you want to follow along at home, you can order the Arduino Kit we are using HERE.

 

Arduino Tutorial 4: Understanding Arduino Variables

In our earlier lessons we would program using “constants” when we needed numbers. For example, if we wanted to set pin 13 to an output, we would use the command:

pinMode(13, OUTPUT);

The problem with using constants like the number 13, if you decided later to use pin 8 instead, you would have to edit every line of code that used that number. It is much better practice to use variables when coding. In this video we show you have to program using variables. We start by doing things the wrong way, using constants, then show you the advantages of using variables.

Hopefully you can see from this video how much better it is, and more efficient to use variables instead of constants. In all the future lessons, we expect you to use variables.