Shutter Controlled with Light
Defining your own blocks
Once the control with the buttons is done, it can be changed to any other type of sensor, such as a light sensor, a remote, a control via the Internet or a mobile application.
Adding an extra control that is compatible with button control requires complicating the program structure. That's why they recommend defining their own blocks to help simplify the code before starting this process.
Control with The sensor reading must be done at intervals
In this case we will use the light level block that we will find in the Sensors category.
The reading of the sensor must be done with large time intervals, to give time to fully raise and lower the blind and also avoid minimal changes in lighting.
It might be interesting to define a block to wait minutes instead of milliseconds.
Challenge 1: Complete the shutter project with keyboard control and light sensor. The shutter stops if either button is pressed.
Solution to challenge 1
⬅️ Previous activity | Next activity ➡️ |
---|
© von Citilab Edutec 2019-2022.
This work is licensed under a CC-BY-SA 4.0 license.