Here’s a micro:bit project to get started for Halloween — or anytime somebody needs a scare! From Mark Ng via DFROBOT
How it works?
The servo motor is set at default 90 degrees position. The ambient light sensor detects the intensity of the surrounding light. When the box is opened, the light level is greater than 100, the servo will move to 170 degrees. A flashing heart will be displayed. When the user closes the box, the light sensor is block by the cover of the box, the servo will move back to the 90 degrees position. The heart will disappear.