Tuesday, 21 December 2021

Hug Avoider 2 - #4tronix #Eggbit




starting hug avoider 2



In an earlier post this year ( 4tronix Eggbit - cute and wearable - hug avoider) I played with 4Tronix's Eggbit (in fact I bought three of them https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special  :-) recently). In that one I used a microbit V1.

In this post, I am using a microbit V2 and replicating the idea but with adding a sound; when people get too close as a bit of fun and surprise for relatives at christmas. 

The code written using Makecode for Microbit (https://makecode.microbit.org/) and the extension for it 4Tronix's developed (see https://4tronix.co.uk/blog/?p=2485 for more details)  is shown below:


makecode for microbit for the hug 2 avoider

Essentially the device goes on; puts a message on the LED display "Hug Avoider 2" and then puts a rainbow on the neopixel syle LEDs and a smile on the small 'mouth' - if the ultrasonic sensor doesn't pick up anyone in front.


No one getting ready to hug


If the ultrasonic sensor picks up anyone in front; LEDS change to red, a sped-up version of one of the standard tunes in Makercode is played and the mouth changes to a surprised look.

detecting someone is too close





Good fun, didn't stop anyone and my son made one with the LEDs lighting up as the person got closer.


What I want to look at is the possibility of programming it with Python - something for the new year.


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

No comments:

Post a Comment

Remote Data Logging with V1 Microbit

In an earlier post  https://robotsandphysicalcomputing.blogspot.com/2024/08/microbit-v1-datalogging.html  a single microbit was used to log ...