The gator:starter, which includes the gator:light and gator:temp can be purchased here. The gator:temp, included on the gator:starter is an analog temperature sensor that can be alligator clipped to the micro:bit or gator:bit board.
To use this package, go to https://makecode.microbit.org, click Add package
and search for gator-temp. The package is located here
//Sets the value of the temperature variable to the value read from the gator:temp
let temperature = 0
temperature = gatortemp.temp(AnalogPin.P0, GatorTempType.F)
Use ||Get Temperature on Pin||
to read the temperature from a gator:temp sensor attached to a certain pin in Celsius, Fahrenheit or the straight ADC value.
This program will take a temperature reading and display it on the micro:bit's screen.
//Read temperature in Fahrenheit and write it the micro:bit's screen.
basic.forever(function () {
basic.showNumber(gatortemp.temp(AnalogPin.P0, GatorTempType.F))
})
- for PXT/microbit
MIT
gatortemp=github:sparkfun/pxt-gator-temp