- Connecting wire
- PIR unit
This tutorial makes use of the PIR (Passive Infra-red) unit to make the safety alarm. When there is something in the front, the alarm will be active. The alarm will be off after several seconds.
Step 1. Click the + button to add an unit.
Step 2. Select PIR unit with port B and click OK.
Step 3. Select RGB LED unit with port A and click OK.
Step 4. When the PIR status is 1, the PIR unit senses the motion of something.
Step 5. Play 520Hz frequency tone with 0.5s when the PIR status is 1.
Step 6. Show RGB bar colour in red when PIR status is 1 and black (no light) when PIR status is 0.
Step 7. Show RGB LED colour in red when PIR status is 1 and black (no light) when PIR status is 0.
Step 8. Test the final code.
Step 9. Execute it and see the result.