GmGniap / pxt-gator-moisture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gator:light Light Sensor

Community Discord

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.

SparkFun gator:light

~ hint

To use this package, go to https://makecode.microbit.org, click Add package and search for gator-light. The package is located here

~

Basic usage

//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.

Example: Light Detector

//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
    )
})

Supported targets

  • for PXT/microbit

License

MIT

gatorlight=github:sparkfun/pxt-gator-light

About

License:MIT License


Languages

Language:TypeScript 60.5%Language:C++ 36.3%Language:Makefile 3.2%