obniz Parts Library

Grove_LightSensor

GitHub
Grove_LightSensor
Usable Devices :
obniz_board
m5stickc
Found at :

Grove_LightSensor

Ambient light sensor.

wired(obniz, {[signal, vcc, gnd, grove]});

connect to the obniz device.
yellow, red and black wires correspond to signal, vcc and gnd respectively.

name type required default description
vcc number(obniz Board io) no   Power Supply
gnd number(obniz Board io) no   Power Supply
signal number(obniz Board iov) no   signal output pin
grove object no   grove interface object if a device has
// Javascript Example
let sensor = obniz.wired("Grove_LightSensor", {grove: obniz.grove0});

This sensor is a three-terminal photo resistor. When a voltage is applied to vcc and gnd, it generates a voltage according to the brightness.
By using a resistor, the change in the voltage can be read.

onchange = function(value)

Change callback of brightness change.
It's value range is 0 to vcc.
value will increase by brightness.

// Javascript Example
let sensor = obniz.wired("Grove_LightSensor", {grove: obniz.grove0});
sensor.onchange = function(value) {
  console.log(value);
}

[await] getWait()

Get brightness only once.

// Javascript Example
let sensor = obniz.wired("Grove_LightSensor", {grove: obniz.grove0});
const value = await sensor.getWait();
console.log(value);

Supported from: obniz.js 3.7.0

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us