From the course: Learning Arduino: Interfacing with Hardware

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Optional review: IF statement

Optional review: IF statement

- [Instructor] So if you are familiar with the if statement you can skip this video, and go to the next one, but if you want to refresh your memory about what an if statement is I'm gonna go briefly, and explain what it is. The most type of constructor command is the if statement. The if statement checks for a condition, and executes the proceeding statement, or set of statements, if the condition is true. Or simply skips the statement to the next line if that condition is not true. The condition is a Boolean type. So it's either true or false. Here's a simple example of using an if statement to check a value if it's greater than hundred. So whenever the value is greater than 100 we have a digitalWrite to a certain pin to be on. In the if statement it simply checks a condition, and then executes the code. There's no increments in the if statement. If the if statement you only have one option of whether or not to…

Contents