Published © LGPL

Grove Starter Kit for Arduino --- Light Sensor

Teaches you how to use the light sensor in the Arduino Grove Starter Kit.

BeginnerProtip30 minutes2,198
Grove Starter Kit for Arduino --- Light Sensor

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1
Seeed Studio SeeedStudio grove starter kit Arduino 101
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Light sensor setup

Code

Light sensor code

Arduino
#include <math.h>

const int sensor=A0; //set the sensor to pin A0

void setup(){
  Serial.begin(9600);//initialize the serial monitor at 9600 baud rate
}

void loop(){
  int sensorValue=analogRead(sensor);//create a var to store the value of the sensor
  Serial.println("the analog read data is ");//print on the serial monitor what's in the ""
  Serial.println(sensorValue);// print the value of the sensor on the serial monitor
  delay(1000);
}

Credits

Comments