How to build a device of detecting the distance with a micro:bit

Purpose
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.
Materails
micro:bit x 1
Sonar:bit x 1
3pin wire x 1
Rivets x 2
Bricks x N
Assembly steps
Install the bricks to Wukong board with the parts as the picture shows:
The connect sonar:bit with the rivets and the 3pin wire.
Hardware Connections
Connect sonar:bit to the P0 port on Wukong board.
Software programming
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.
Coding
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.
Complete code
Link:https://makecode.microbit.org/_bogg4T9KgbVo
Completed! Now we can find a wire to have the device hung on our body to keep the social distance with others.
Result
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
Related Posts
Introduction to the history of the BBC micro:bit
New BBC micro:bit-micro:bit V2
How to make a meme with micro:bit ?
Topics
- Curriculum
- Course
- Micro bit supplier
- Wholesale Suppliers
- Micro bit tutorial
- Micro bit classroom pack
- Mcorbit Environment Monitoring
- Temperature-controlled
- Motor
- Fan
- TPBot car
- TPBot
- Micro:bit car
- AI Lens
- Micor:bit AI Lens
- Micro:bit LEDs
- BBC micro:bit
- Micro:bit Manipulator
- Wukong board
- Cutebot
- Micro:bit Motorcycle
- Nezha breakout
- Micro:bit DIY
- 360° servos
- AI Lens
- Retro Arcade
- Ecode
- PlanetX
- Microbit programming
- Your:bit
- Do your:bit
- IoT:bit
- Octopus
- Rainbow LED Ring
- Joystick:bit
- Wonder Building Kit
- Sensor:bit
- Downie
- Wenjie
- Laser Engraver Tutorial
Tags
Comments