I was at a school out in western NSW on Wednesday this week and was showing the Agriculture teacher how they could use microbits in their aquaponics project. I decided to code a simple water level alarm for them using a grove inventor kit 4 digit display (p1/p15) and a grove ultrasonic sensor ( p2/p16) ,
The sensor reports back the distance to the water – so if supported over a barrel it reports the water level. It actually senses the distance from the ultrasonic sensor to the surface. If that surface distance changes the display reports the new level. Obviously this can then do something if the level changes too much – like flash the LEDs or play a tune or whatever.
OF course you could add the coding for “if distance > 10 then display LEDs” or whatever. I’ve just reproduced the basic code.
The microbit v1 worked just fine with this code:
However when I replaced the microbit v1 with a microbit v2 the code failed big time and the microbit displayed the sad face followed by the 020 error code.
To be honest I actually coded it first with the microbit V2 and it failed, so I replaced the v2 microbit with a v1 microbit, added a buzzer to pin 0 and it worked fine. I figured the code was correct…and for v1 microbits it is…but not for v2 microbits.
So since many you guys are tinkers, maybe you can replicate this issue and see what you think the problem is…What a nice thing to do on a rainy weekend. Below is the setup using the microbit and the grove stuff.
Shaby
This is with a v1 microbit - works fine. Replaced with v2 and it didn’t work either with or without the external speaker.
I tried to add a photo of the device setup bit as a new user I was prevented from doing this. I will add it in an addendum called microbit v2 error with grove inventor kit addendum