이하늘gledel임동교
Published © GPL3+

InoLab: Reading a Photoresistor

This project was made by Innovation Lab in Bongilcheon High School.

BeginnerShowcase (no instructions)30 minutes665
InoLab:  Reading a Photoresistor

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Photo resistor
Photo resistor
×1
LED (generic)
LED (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

z_0HP8XQaZEX.PNG

Code

Untitled file

Arduino
const int sensorPin = 0;
const int ledPin = 9;
int lightCal;
int lightVal;
void setup()
{
pinMode(ledPin, OUTPUT);
lightCal = analogRead(sensorPin);
}
void loop()
{
lightVal = analogRead(sensorPin);
if (lightVal < lightCal - 50)
{
digitalWrite(9, HIGH);
}
else
{
digitalWrite(9, LOW);
}
}

Credits

이하늘

이하늘

5 projects • 3 followers
gledel

gledel

100 projects • 91 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
임동교

임동교

0 projects • 8 followers

Comments