The Bomb Cyclone has hit the Northeast. With nighttime temperatures of -10, I was worried that the water pipe in the garage would freeze. So I decided to use the radio and temperature features of the Micro:bit to warn me if the temperature in the garage went below freezing.
First the Sending Micro:bit
The temperature sensor outputs in centigrade and since the Makecode cannot deal with floating point variable (ugh), I kept the values in centigrade. The temperature sensor is actually a part of the CPU.
“The BBC micro:bit does not have a dedicated temperature sensor. Instead, the temperature provided is actually the temperature of the silicon die on the main CPU. As the processor generally runs cold though (it is a high efficiency ARM core), the temperature is a good approximation of the ambient temperature”
Since the reading is an approximation, I created an offset variable to compensate for the difference between the actual temperature to what the Micro:bit thought the temperature was.
The TempC variable is sent over the radio to the receiving Micro:bit in my living room. The Micro:bit will play a song of the temperature falls below 0 Celcius.
The Receiving Micro:bit
The receiving code is straightforward. After setting the radio group in the On Start block, the Micro:bit just waits for a received number. If the number is less than zero, a tune is played.
I found two interesting posts; one to transmit data to a website and another to integrate with IFTTT. So more to follow.