Case 73: A Mock Awning
77. Case 73: A Mock Awning#
The right amount of UV rays has a boosting effect on plant growth, but too much UV rays can prevent many of the plant’s life activities from going on properly. So we can make a UV shade and open it when the UV index is high to prevent the plants from being sunburned.。
77.2. Case building#
The structure is built as shown in the figure:
In the diagram below, connect the UV sensor to the J1 port and the servo to the S1 port of the Nezha Board.
77.3. Makecode Programming#
In the code drawer of MakeCode click on “Extensions”.
In order to program the UV sensor, we need to add an extension library. Type “PlanetX” in the dialog box and click Search, then click to download this library.
In order to program the Nezha expansion board, we need to add an expansion library. Type “Nezha” in the dialog box and click Search, then click to download this library.
*Note: *If you get a prompt saying that some code libraries will be removed for incompatibility reasons, you can either follow the prompt and continue, or create a new project inside the project menu bar.
Write the program as shown in the figure#
You can also download the program directly from the following webpage and start running the program once the download is complete.
The UV sensor is used to detect the current ambient UV index, and the shade is opened when the UV index is too high.