The gator:starter, which includes the gator:moisture and gator:temp can be purchased here. The gator:moisture, included on the gator:starter is an analog moisture 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-moisture. The package is located here
//Sets the value of the light variable to the value read from the gator:light
let light = 0
light = gatorlight.light(AnalogPin.P0, gatorMoistureType.Lux)
Use ||Get light on pin|| to read the light value from a gator:light sensor attached to a given pin in lux or the straight ADC value.
//Read light value and write it to the micro:bit screen as a bar graph.
let light = 0
basic.forever(function () {
light = gatorlight.light(AnalogPin.P0, gatorMoistureType.Lux)
led.plotBarGraph(
light,
1023
)
})
- for PXT/microbit
MIT
gatorMoisture=github:yyaaron/pxt-gator-moisture-temp