EDIT: Turns out my "fix" was skipping the
sleep step which caused the loop cycles to be a bit too fast. Good thing Tom caught that ;)
The Micro:bit gets a warm Christmas welcome by some of the other flashing LEDs in our house.
So the plan is to make a simple dice roller application.
I didn't get the chance to work on this yesterday due to Christmas preparations but today I got a couple of hours playing with the Micro:bit again :)
Back to detecting dice rolling, turns out this wasn't too hard but I did need to play a little bit with calibrating the thresholds for detecting consecutive changes in acceleration. There are probably more precise ways to do this, but it works for now!
I just realised this is very similar to what Martin O'Hanlon did with his 8-ball shuffle, our solution was actually pretty similar. I had to add some time thresholds as well, otherwise the shake event ended up happening way too easily and offset.
Since Christmas often means snow (at least for us living in the northern hemisphere) I thought to try to generate some snowflakes on the microbit.
Since snowflakes are symmetrical, we should only have to create a 3x3 corner and rotate that 45° at a time that to get the full shape. End result might resemble a star-wars spaceship instead of snowflakes. Equally seasonal?
Here's how it looked like:
and here's the code.
I have recently been pretty bad at keeping my house plants alive. I need to add reminders to take care of my plants, and I usually end up ignoring them as "I'll do it when I get home", and then I almost never do. Wouldn't it be nice if the plant could tell you that it needs attention?
Plants don't have faces to express themselves, so what if the micro:bit could work for that purpose?
Excluding cacti, the one thing that plants usually need the most is ground moisture. How is moisture measured? The internet says that conductivity is a pretty good indicator.
So with a simple Ohmmeter we could measure the increase/decrease in resistance and by setting a few reasonable thresholds we can tell what the resistance corresponds to in terms of moisture levels.
The nails were used as ground probes, one connected to power and one connected to
pin0. The resistor was used as the "known" resistor for the ohmmeter. To replicate this you could use any resistor/ground probes/cabling. Just make sure the code is adapted for the resistor and that the probes are resistant to corrosion.
Also it goes without saying that you should keep the micro:bit at a safe distance from water and dirt ;)
In terms of programming, I set the micro:bit to display a happy, ok or sad face depending on the value of the resistor. Finding the correct thresholds was tricky as they can vary depending on the soil, distance between the probes etc. (code)
So, without further ado here's a watering demo of one of my plants (which I kept without water for a few days for that purpose as you can see from its horrible condition!):
As you can see with a bit of watering the plant becomes "OK" and with a bit more it becomes "Happy" ;)
A few potential extensions to this project (probably more important for outdoor plants...):