HELP NEEDED FOR CODE! MY last code didn't turn out well, NEED a new code ASAP! Watch video down below to get a general idea of what we are doing
Skip to about 6:30 minutes to see the demonstration
Also read the description of project
For this project, you will create a small environmental-control system around your photo resistor. With the photo resistor in series with the 10kΩ resistor (just like in the tutorial), figure out the range of your analog input for your light environment. IE, figure out your minimum value when the photo resistor is covered and your maximum value when the photo resistor is uncovered. Use the map function to scale this range to a minimum of 200 and a maximum of 600. Then use an LED or LEDs and the servo to keep this mapped input from the photo resistor between 350 and 450. The LEDs will help you do this because they can provide light to the photo resistor if it gets too dark. The servo will help you do this because if you attach a small piece of paper or card to it, it can provide shade to the photo resistor if it gets too light. Note that the different LEDs provide different amounts of light, and vary in intensity depending on whether you look at the side, bottom, or top of one. To demonstrate the functionality of your control system you will video it working while you first shine a light on it (making the shade cover the photoresistor) and when you dim the lights in your room (making the LED's turn on). While this is happening you should be printing the value of the analogread from the photoresistor to the serial monitor...and this value should stay between 350 and 450. To read the input from the pin sensing your photoresistor on your screen, include the line Serial.begin(9600); in the setup, and Serial.println(lightLevel); just after int lightLevel = analogRead(lightPin);