Approved content
The content below is provided by a partner.
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.
//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))
})
MIT
gatortemp=github:sparkfun/pxt-gator-temp
gatorTemp=github:sparkfun/pxt-gator-temp#v0.0.11