Peer-graded Assignment: Peer Asssignment: Light an LED Answer
In this article i am gone to share Coursera Course: Interfacing with the Arduino Week 2 Peer-graded Assignment: Peer Asssignment: Light an LED Answer with you.
Peer-graded Assignment: Peer Asssignment: Light an LED Answer
Instructions
Build a circuit that lights an LED when it is sufficiently dark in a room. Demonstrate the circuit by covering the photoresistor to simulate darkness..
Review criteria
- Build a circuit that lights an LED when it is sufficiently dark in a room. Demonstrate the circuit by covering the photoresistor to simulate darkness.
- Turn in a video demonstration of the circuit in action. Show the behavior of the system with the photoresistor uncovered and with the photoresistor covered.
- Regardless of which method you use, provide a link to the location of your video or screencast on the Internet. Do not upload your video here.
See the details on the Course Overview page regarding purchasing the hardware and/or using a web-based simulator.
My submission
Screenshot
Source Code..
#define LED_PIN 13#define SENSOR_PIN A0#define BRIGHTNESS_THRESHOLD 900void setup() {pinMode(LED_PIN, OUTPUT);}void loop() {int sensorValue = analogRead(SENSOR_PIN);int state = (sensorValue <= BRIGHTNESS_THRESHOLD) ? HIGH : LOW;digitalWrite(LED_PIN, state);}
____________________________________________________________________________
Simulation
Build a circuit that lights an LED when it is sufficiently dark in a room. Demonstrate the circuit by covering the photoresistor to simulate darkness..____________________________________________________________________________
0 Comments