Grove Starter Kit for Arduino --- Light Sensor

Grove Starter Kit for Arduino --- Light Sensor © LGPL

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

  • 2,158 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

This is a really simple project that shows how to use the light sensor in the Arduino 101 Grove Starter Kit.

Setup:

For setup, all you have to do is connect the sensor to A0.

Code:

The code is very simple, you basically just read the sensor and voila!

Code

Light sensor codeArduino
#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);
}

Schematics

Light sensor setup
Dscn4083 y0i8sl2nyz

Comments

Add projectSign up / Login