A project to indicate if a person or object is detected within a range of safety zones, by illuminating an RGB LED, sounding a tone, displaying a graphic and/or scrolling message. Created for the BBC micro:bit V2 computer interfaced with an Osoyoo sensors & devices STEM kit and a third-party interface board.
LED colours indicate:
- Red = 'danger',
- Amber = 'unsafe',
- Green = 'safe'.
I've always intended this for my work desk; the next steps will likely be the addition of the LCD display to refine the messaging.
An embedded system computer, with dimensions half the size of a credit card. Code must be written on a computer or a portable device before 'flashing' the program to the micro:bit via a either USB cable or Bluetooth.
It uses the Microsoft MakeCode IDE (blocks of code similar to Scratch.) In this case all the coding has used the iPhone micro:bit app. However, other platforms, apps and languages can be used.
Note: I have used only the block editor so be aware that the underlying 'written' code may not be ordered 'neatly'. (I originally thought the MicroPython code from the app would be saved here but only the javascript makes it to the repo; see the Main.ts file.)
Various breakout boards are available, but I chose the Osoyoo STEM Kit for micro:bit. The kit comprises the board, 20 sensors & devices, cables with connectors, an IR remote, an instruction CD, all packaged up in a sturdy box.
The third-party board does mot replicate the connector pinout order so I've not named it here.
I made the rookie mistake of thinking all the micro:bit and thus the Osoyoo board pins would be addressable identically. This is not the case. Here is the official documentation:
https://makecode.microbit.org/device/pins
Open this page at https://bazbt3.github.io/microbit-proximity/
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/bazbt3/microbit-proximity and click import
This image shows the blocks code from the last commit in master. This image may take a few minutes to refresh.
- for PXT/microbit