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.

  • 1,324 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

Similar projects you might like

Grove Starter Kit for Arduino: Touch sensor

by Grant

  • 1,201 views
  • 1 comment
  • 2 respects

Grove Starter Kit For Arduino --- RGB LCD

by Grant

  • 8,672 views
  • 2 comments
  • 10 respects

Smart Home Sensor Node

Project tutorial by vincent wong

  • 10,821 views
  • 3 comments
  • 17 respects
Add projectSign up / Login