Professional Documents
Culture Documents
المحاضرة الثالثة
المحاضرة الثالثة
Parameters:
pin: the Pin number you wish to read its status
Val: variable to save the return of the function
Note: the pin should be previously set as INPUT port.
Syntax:
if (condition) {
Target Code;
Conditions:
x == y (x is equal to y)
x != y (x is not equal to y)
x < y (x is less than y)
x > y (x is greater than y)
x <= y (x is less than or equal to y)
x >= y (x is greater than or equal to y)
Logical operators:
Not ----------- (!condition)
AND ---------- (condition1 && condition2)
OR ---------- (condition1 || condition2)
if (x == 50)
{
digitalWrite(2, HIGH);
}
Syntax:
if (condition) {
Target Code (if condition is True);
}
else {
Target Code(if condition is False);
}