Development (Advanced)
Make a Complicated Piston
User Story: As a user, when my door opens and I am at home, I want my bulb to be turned on with green color. When my door opens and I am away, then turn on the alarm switch. When my door closes and I am away, Turn off the bulb.
- IF
- Contact Sensor is OPEN
- THEN
- IF
Location Mode is Away - THEN
Turn alarm Switch 1 ON - ELSE
- IF
Bulb 1 is OFF - THEN
Turn Bulb 1 ON
Set Bulb 1 Color to Green
- IF
- IF
- ELSE
- IF
Location Mode is Away and
Bulb 1 is ON - THEN
Turn Bulb 1 OFF
- IF
-
Create a New Piston.
-
Add a new statement in webCoRE editor.
-
Add the first If condition.
-
Add the first nested If condition.
-
Add the first nested condition.
-
Add the second level nested If condition inside the Else.
-
Add a second level nested command.
-
Add a nested If statement inside first Else.
-
Add one more condition.
-
Add a nested command for Else.
- Click Save, you can see the newly created piston on the dashboard.
{% endtextbox %}
You're done!
Congratulations! You have successfully achieved the goal of this Code Lab activity. Now, you can create both basic and complicated piston on webCoRE by yourself!