Lesson 7 Photoresistor
Lesson 7 Photoresistor
Introduction
In this lesson, you will learn how to measure light intensity using an Analog
Input.
Hardware Required
1 * RexQualis UNO R3
1 * Breadboard
8 * LED
8 * 220ohm Resistors
1 * 74HC595 IC
1 * 1kohm resistor
1 * Photoresistor
Principle
Photoresistor
int leds = 0;
void setup()
//The 'setup' function just sets the three pins we are using
to be digital outputs.
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void updateShiftRegister()
digitalWrite(latchPin, LOW);
digitalWrite(latchPin, HIGH);
void loop()
{
leds = leds + (1 << i); // sets the i'th bit
updateShiftRegister();
Experimental Procedures
Schematic Diagram
Step 2:Open the code:Photoresistor_Code
Step 3: Attach Arduino UNO R3 board to your computer via
USB cable and check that the 'Board Type' and 'Serial Port' are
set correctly.