JANAK13
Published © GPL3+

Using Sensors with Arduino

This is a tutorial on how to use sensors with Arduino.

BeginnerFull instructions provided29,394
Using Sensors with Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Light Detecting Resistor
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The circuit

This is how the connection is to be made.

Code

Using LDR with Arduino

C/C++
You will have to upload this code on to Arduino Uno.
int sensor1Value = 0;
void setup()
{
  // declare the ledPins as an OUTPUT:
  pinMode(13, OUTPUT);
  
}

void loop() {
  // read the value from the sensor:
  sensor1Value = analogRead(A0);
{
  if(sensor1Value <200)     // check the value of sensor 
 {                          //if the value is less than 200 then turn the leds on
 digitalWrite(13, HIGH);
  delay(500);
 }
 else                      // if the value is greater than or equal to 200 then turn leds off
 {
  digitalWrite(13, LOW);
  delay(500);
}
}

Credits

JANAK13
6 projects • 44 followers
Contact

Comments

Please log in or sign up to comment.