Ingo Lohs
Published © GPL3+

Grove - Introduction in a Light Sensor


BeginnerProtip1 hour8,826
Grove - Introduction in a Light Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Seeed Studio Grove Base Shield
Seeed Studio Grove Light Sensor

Software apps and online services

Arduino Web Editor
Arduino Web Editor


Read more


Light Sensor - Example

Original code by Seeedstudio
/* Grove - Light Sensor demo v1.0
* Signal wire to A0.
* By:
#include <math.h>

#define LIGHT_SENSOR A0//Grove - Light Sensor is connected to A0 of Arduino
const int ledPin=12;                 //Connect the LED Grove module to Pin12, Digital 12
const int thresholdvalue=10;         //The treshold for which the LED should turn on. Setting it lower will make it go on at more light, higher for more darkness
float Rsensor; //Resistance of sensor in K
void setup() 
    Serial.begin(9600);                //Start the Serial connection
    pinMode(ledPin,OUTPUT);            //Set the LED on Digital 12 as an OUTPUT
void loop() 
    int sensorValue = analogRead(LIGHT_SENSOR); 
    Rsensor = (float)(1023-sensorValue)*10/sensorValue;
    Serial.println("the analog read data is ");
    Serial.println("the sensor resistance is ");
    Serial.println(Rsensor,DEC);//show the ligth intensity on the serial monitor;


Ingo Lohs

Ingo Lohs

182 projects • 194 followers
I am well over 50 years and come from the middle of Germany.