grove.grove_light_sensor_v1_2

This is the code for

Examples

import time
from grove.grove_light_sensor import GroveLightSensor

# connect to alalog pin 2(slot A2)
PIN = 2

sensor = GroveLightSensor(pin)

print('Detecting light...')
while True:
    print('Light value: {0}'.format(sensor.light))
    time.sleep(1)

Classes

class grove.grove_light_sensor_v1_2.GroveLightSensor(channel)[source]

Grove Light Sensor class

Parameters:

pin (int) – number of analog pin/channel the sensor connected.

Inheritance

digraph inheritance8345be415a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GroveLightSensor" [URL="#grove.grove_light_sensor_v1_2.GroveLightSensor",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Grove Light Sensor class"]; }
property light

Get the light strength value, maximum value is 100.0%

Returns:

ratio, 0(0.0%) - 1000(100.0%)

Return type:

(int)