Peer-graded Assignment: Peer Assignment: Build a Circuit Answer
In this article i am gone to share Coursera Course: Interfacing with the Arduino Week 1 Peer-graded Assignment: Peer Assignment: Build a Circuit Answer with you.
Peer-graded Assignment: Peer Assignment: Build a Circuit
Instructions
Build a circuit that contains two push buttons, an LED, and any other basic components you think you need. The LED should turn on when either the first button or the second button is pressed. Only use your Arduino for power and ground.
Review criteria
- You will create a video demonstration of the circuit in action.
- If you have real hardware, demonstrate the real circuit. If you do not have real hardware, use the simulator.
See the details on the Course Overview page regarding purchasing the hardware and/or using a web-based simulator.
My submission
Screenshot
Source Code
#include <Servo.h>int sensorValue;int analogInPin = A0;int analogOutPin = 6;Servo myLED;void setup(){}void loop(){sensorValue = analogRead(analogInPin);sensorValue = map(sensorValue, 0, 1023, 0, 225); //analogRead ranges from 0 to 1023; analogWrite ranges from 0 to 255; this maps the sensorValue to the lower output rangeanalogWrite(analogOutPin,sensorValue);}
____________________________________________________________________________
Simulation
Build a circuit that contains two push buttons, an LED, and any other basic components you think you need. The LED should only light when both push buttons are pressed. Only use your Arduino for power and ground.____________________________________________________________________________
0 Comments