Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
58 views

Experiment 1: Traffic Lights: Description of The Project

The document describes an experiment to create a set of traffic lights that cycle through the colors green, amber, and red using LEDs and a microcontroller. It explains that LEDs are semiconductors that emit light when electric current passes through and discusses the basic components of an LED. The circuit connection for the traffic lights is shown, involving red, yellow, and green LEDs connected to pins on a microcontroller. The code to control the light cycling is provided, using delays to control the timing of changing the three colors in a repeating loop.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Experiment 1: Traffic Lights: Description of The Project

The document describes an experiment to create a set of traffic lights that cycle through the colors green, amber, and red using LEDs and a microcontroller. It explains that LEDs are semiconductors that emit light when electric current passes through and discusses the basic components of an LED. The circuit connection for the traffic lights is shown, involving red, yellow, and green LEDs connected to pins on a microcontroller. The code to control the light cycling is provided, using delays to control the timing of changing the three colors in a repeating loop.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

16/10/2019

Experiment 1: Traffic Lights

We are now going to create a set of traffic lights


that will change from green to red, via amber, and
Description of the Project
back again, after a set length of time using the 4-
state system..

The components needed

10/16/2019 1

The Light Emitting Diode (LED)

LED is a semiconductor device that emits visible


light when an electric current passes through it.
What is LED
Some LEDs emit infrared (IR) energy; such a
device is known as an infrared-emitting
diode (IRED). An consists of two elements of
processed material called P-type semiconductors
and N-type semiconductors. These two elements
are placed in direct contact, forming a region
called the P-N junction. In this respect, the LED
or IRED resembles most other diode types, but
there are important differences.

Symbol of LED

10/16/2019 2

1
16/10/2019

The Circuit Connection for the Traffic Light

10/16/2019 3

The Circuit Connection for the Traffic Light

10/16/2019 4

2
16/10/2019

void loop() {
digitalWrite(redPin, HIGH); // turn the red light on
int ledDelay = 10000; // delay in between
delay(ledDelay); // wait 5 seconds
changes
digitalWrite(yellowPin, HIGH); // turn on yellow
int redPin = 10;
delay(2000); // wait 2 seconds
int yellowPin = 9;
digitalWrite(greenPin, HIGH); // turn green on
int greenPin = 8;
digitalWrite(redPin, LOW); // turn red off
void setup() {
digitalWrite(yellowPin, LOW); // turn yellow off
pinMode(redPin, OUTPUT);
delay(ledDelay); // wait ledDelay milliseconds
pinMode(yellowPin, OUTPUT);
digitalWrite(yellowPin, HIGH); // turn yellow on
pinMode(greenPin, OUTPUT);
digitalWrite(greenPin, LOW); // turn green off
}
delay(2000); // wait 2 seconds
digitalWrite(yellowPin, LOW); // turn yellow off
// now our loop repeats
}}

10/16/2019 5

10/16/2019 6

You might also like