The gator:starter, which includes the gator:light and gator:temp can be purchased here. The gator:light, included on the gator:starter is an analog light 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-light. 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, gatorlightType.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, gatorlightType.Lux)
led.plotBarGraph(
light,
1023
)
})
- for PXT/microbit
MIT
gatorlight=github:sparkfun/pxt-gator-light