Introduction: Photo Resistor Color Changing LED
Abstract
We are doing this to show you (audience) how to use a photo resistor works
Supplies
1. A bread board
2. a Arduino uno
3. A photo resistor
4. a color changing LED
5. some wires to connect these parts together
6. possibly a resistor if you choose to use one
Step by step instructions
1. Start off by hooking up the Arduino to one of the USB ports in the tower
2. Place the color changing LED into the bread board in sync with how it's labeled (Positive and Negative)
3. Connect a wire to port 13 in the Arduino and then take the other side of the wire and connect it to the bread board in the same row as any of the positive LED wire (nothing gets connected to the negative LED wire yet)
4. Then you connect a 1200 ohm resistor to the bread board (Not in any row the LED is connected to)
5. Then you connect one side of the photo resistor to one side of the resistor (has to be connected to the same row as the resistor)
6. have a wire connected to the 5v pin then connect it to the same row on the other side of the resistor then have a wire connected to analog pin 0.then have the other side of the wire connected as the same row as the resistor and photo resistor
7. Connect a wire to the ground port that is next to the 5 volts and connected it to the same row as the photo resistors wire
8. Then have a wire go to the ground of the LED ,to the negative side of the bread board and have another wire going to the negative side of the bread board and connect it to the ground next to pin 13
this is the code we used to program our arduino:
int Pr = 0;
int PrValue = 0; int Pr_Input = 700;
void setup() { Serial.begin(9600); //start serial Monitor
pinMode(13, OUTPUT); }
void loop() { PrValue = analogRead(Pr); Serial.println(PrValue); delay(100);
if (PrValue < Pr_Input) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } }