Shutter Controlled with Light

Shutter Controlled with Light

Citilab Edutec tarafından

Boards
Kartlar:

Citilab ED1

Component/s
Bileşenler:

Servo (360°)
This activity is part of the Citilab Course. Check it out!

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.

Custom blocks

Shutter with buttons

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.

Minutes Block

Challenge 1: Complete the shutter project with keyboard control and light sensor. The shutter stops if either button is pressed.

Challenge

Solution to challenge 1

CC-BY-SA

© Citilab Edutec tarafından 2019-2022.
This work is licensed under a CC-BY-SA 4.0 license.