Tuesday, April 2, 2019
Creation of Traffic Light Circuit
Creation of business Light CircuitIntroduction job lights or calling signals is employ to reign the traffic and to supervised motorist and pedestrians. The lights alternate accorded to users by displaying commonalty for go, yellow signal that the light testament change to rosy and red for stop. Without traffic lights there will be a lot of highway accidents and traffic congestion. This experimentation shows how traffic lights work using Arduino.Materials with Description5 MM light-emitting diode (5)Used as an output in the rophy and to know if the code is working.Resistor (220 ohms) (6)An electronic device used to control the current in the rope.Jumper Wires M/M (13)Used as the continuative to different pivot mans in the prototy downslopeg board.USB cable (1)Used as the connector from computer to DFRArduino Uno R3.DFRArduino Uno R3 (1)A programmable circuit board. This hardware reads the code uploaded in the computer. calculator (1)Used to write, compile and upload the c ode to the circuit.Procedure (self-explained)Place the LEDs to the board. Traffic lights for pedestrians, green(1) positive iris at ensnare J17 and negative sword lily to downslope J16, red(1) positive pin at pin J14 and negative pin to pin J13.2.Traffic lights for motorist, green(2) positive pin at pin J8 and negative pin to pin J7, yellow positive pin at pin J5 and negative pin to pin J4. red(2) positive pin at pin J2 and negative pin to pin J1.3. Plot the push button switcher at pin E10,E12, F10 and F12.Place the resistor(1) from D2 to G2, resistor(2) from D5 to G5, resistor(3) from D8 to G8, resistor(4) from D14 to G14, resistor(5) from D17 to G17, resistor(6) from C7 to C10Connect the jumper wires, wire(1) from A2 to DP 12, wire(2) from A5 to DP 11, wire(3) from A7 to GND, wire(4) from A8 to DP 10, wire(5) from A10 to DP 9, wire(6) from A14 to DP 8, wire(7) from A17 to DP7, wire(8) from C12 to PP 5V, wire(9) from I1 to I4, wire(10) from H4 to H7, wire(11) from I7 to I13, wi re(12) from H13 to H16, and wire(13) from I16 to GND.6. Connect the USB cable to the computer and the circuit, compile the code thus upload.Circuit DiagramCodeCode Analysis int carRed = 12, int carYellow = 11, int carGreen = 10 this is the initialization of pins for motorists traffic lights.int button = 9 the initialization of the pushbutton committed to the Arduino.int pedRed = 8, int pedGreen = 7 the initialization of pins for pedestrian lights.int crossTime = 5000 sets 5 countenances for the pedestrian LED to lit.pinMode(pinType,OUTPUT) pinType sets what pin to use, LEDs in this circuit serves as output.pinMode(button, INPUT) the input in the circuit came from the push button switcher.int state = digitalRead(button) reads if the push button switcher is pushed/press or not.if (state == HIGH) (millis() changeTime) 5000) a condition that checks if the push button switchern was pressed 5 seconds and then call the method changeLights().void changeLights() in this method, it indic ates the sequence lights when it will lit and shows how car/motorist and pedestrian traffic lights work.delay(2000) delays for 2 seconds beforehand it the green light changes to yellow light and delay(1000) delay for a second before it goes red.changeTime = millis() this stores the current time in milliseconds to changeTime by calling millis(). affinity of Code vs. Hardware OutputThe code manipulate, manages and provides the output for the hardware. In this experiment if you push or press the push button switcher it changes its lights in a of set time and this shows how traffic lights works.Recommendation/EnhancementWe squeeze out use this traffic light experiment to create mini traffic lights inside the car or motor. In that case the motorist far on the traffic light will also know the signal.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment