2. Drag and Drop the “if then else” block in the “coding area”.
If-else statement : is also called as branching as a program decides which statement to execute based on the result of the evaluated condition. Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed, if the same condition is false.
Here, we are using if then else statement to set the LED HIGH if PIR sensor senses the motion else LED will not GLOW.
Login
Accessing this course requires a login. Please enter your credentials below!