arduino session 2 esraa
arduino session 2 esraa
switch
If
If statement
1- if statement
if (/* if condition */)
{
// if body
}
else if (/*else if condition */ )
{
// if body
}
else
{
// else body
}
Nested If
Nested If in C Programming is placing If •
Statement inside another IF Statement.
Nested If in C is helpful if you want to check the •
condition inside a condition.
Syntax of nested if
switch (expression) { •
case constant1: // statements •
break;
case constant2: // statements break; •
default: // default statements •
} •
Command in arduino
To write value to a digital pin use the command
digitalWrite(pin,HIGH ) if you want to write 5v •
to the pin
OR digitalWrite(pin,LOW ) if you want to write
zero v to the pin
To read a value from a digitalpin use the
command digitalRead(pin).
The second project is to turn on led with a
push button