How to build a device of detecting the distance with a micro:bit
The novel Coronavirus is still existing in the world and we need to make sure the social distance be kept in public areas such as in hospitals or banks. This device will warn people who do not keep enough distances to others.
micro:bit x 1
Sonar:bit x 1
3pin wire x 1
Rivets x 2
Bricks x N
Install the bricks to Wukong board with the parts as the picture shows:
The connect sonar:bit with the rivets and the 3pin wire.
Connect sonar:bit to the P0 port on Wukong board.
Go to MakeCode editor:（https://makecode.microbit.org/#editor）Add Wukong extension from the settings on the right upper conner.
Add the extension package of neopixel.
Initialize the RGB on the Wukong board in the on start brick.
Save the variable of the sonar bit as “i” in forever brick.
Judge if “I”is between 3~100, if yes, set the RGB as red; or set it in green.
Completed! Now we can find a wire to have the device hung on our body to keep the social distance with others.
It lights up in red if someone is within one meter away from you or it lights in green.
Share this post
About the Author
ELECFREAKS focuses on microbit and publishes interesting articles
- Micro bit supplier
- Wholesale Suppliers
- Micro bit tutorial
- Micro bit classroom pack
- Mcorbit Environment Monitoring
- TPBot car
- Micro:bit car
- AI Lens
- Micor:bit AI Lens
- Microbit gyroscope
- Micro:bit LEDs
- BBC micro:bit
- Micro:bit Manipulator
- Wukong board
- Micro:bit Motorcycle
- Nezha breakout
- Micro:bit DIY
- 360° servos
- AI Lens