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:light, included on the gator:starter is an analog light sensor that can be alligator clipped to the micro:bit or gator:bit board.
//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
)
})
MIT
gatorlight=github:sparkfun/pxt-gator-light
gator-light=github:sparkfun/pxt-gator-light#v0.0.3