Case 10: The Farm Protection Devices
16. Case 10: The Farm Protection Devices#
In order to protect the farmlands from people to get in, we can set a farmland protection device.
16.2. Materials Requested#
16.3. Relevant Parameters#
|Model||TOOCA Laser 1|
|Material of consumables||Basswood board|
|Times required to be engraved/cut||3|
Note: This case takes a 2.8mm basswood board as an example. If you need to use different thicknesses or use different materials, please modify the drawing by yourself and refer to the
Recommended parameter modify the parameters of the software.
16.5. Hardware Connection#
Connect the Sonar:bit to P1, the PIR sensor to P2 on IoT:bit.
16.6. Software Programming#
Click “Advanced” in the MakeCode to see more choices.
For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “iot-environment-kit” in the dialogue box to download it.
Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.
Set the ultrasonic sensor to connect to P1, measure the distance in cm, and save the return value to the variable “ultrasonic_distance”, set the PIR sensor to connect to P2, and save the return value to the variable “IR”.
Judge whether the value of variable “ultrasonic_distance” is within the threshold, if so, judge whether the return value of variable “IR” is 1, if the return value of variable “IR” is 1, then set the LED matrix to display the icon and the buzzer to sound the alarm otherwise turn off the light.
If the value of the variable “ultrasonic_distance” is not within the threshold, set to display the icon as we progrommed.
When someone approaches the farmland, the farmland protection device will display the icon and sound an alarm to warn others to stay away.
16.9. Effect Show#
16.10. material data#
Welcome to join the Laser Engraving Cutter Creative Sharing Community to share your creativity.