0% found this document useful (0 votes)
24 views3 pages

Embedded

The document describes a traffic light system with 4 intersections (A, B, C, D) that cycles through green, yellow, and red lights every 5 seconds. It includes a table showing the light patterns, a circuit diagram, and Arduino code to control the lights. The system uses digital pins on an Arduino board to control 12 LEDs to represent the lights and cycles through the intersections sequentially with a 5 second delay between changes.

Uploaded by

Elka Anggun Sari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Embedded

The document describes a traffic light system with 4 intersections (A, B, C, D) that cycles through green, yellow, and red lights every 5 seconds. It includes a table showing the light patterns, a circuit diagram, and Arduino code to control the lights. The system uses digital pins on an Arduino board to control 12 LEDs to represent the lights and cycles through the intersections sequentially with a 5 second delay between changes.

Uploaded by

Elka Anggun Sari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama : Elka Anggun Sari

Prodi : Teknik Komputer B


Matkul : Robotika Praktik B
1. Diskriptif
Pada rangkaian tersebut terdapat 4 persimpangan. Pada persimpangan A Lampu hijau
menyalah(HIGH) setelah lampu hijau mati(LOW) lampu kuning yg menyalah(HIGH) dan
di persimpangan 2, 3, 4 lampu hijau of(low) dan lampu merah menyalah(HIGH).pergantian
setiap persimpangan 5 detik untuk pindah ke persimpangan selanjutnya, begitu juga
seterusnya.
2. Tabel
Red Yellow Green Red Yellow Green Red Yellow Green Red Yellow Green
A A A B B B C C C D D D
0 0 1 1 0 0 1 0 0 1 0 0
1 1 0 0 1 1 1 0 0 1 0 0
1 0 0 1 0 0 0 1 1 1 0 0
1 0 0 1 0 0 1 0 0 0 1 1

3. Rangkaian

Link : https://www.tinkercad.com/things/9pr63zvjmtG-amazing-elzing/editel?tenant=circuits
4. Source Code
int redA = 13;
int yellowA = 12;
int greenA = 11;
int redB = 10;
int yellowB = 9;
int greenB = 8;
int redC = 7;
int yellowC = 6;
int greenC = 5;
int redD = 4;
int yellowD = 3;
int greenD = 2;

void setup() {
pinMode (redA, OUTPUT);
pinMode (yellowA, OUTPUT);
pinMode (greenA, OUTPUT);

pinMode (redB, OUTPUT);


pinMode (yellowB, OUTPUT);
pinMode (greenB, OUTPUT);

pinMode (redC, OUTPUT);


pinMode (yellowC, OUTPUT);
pinMode (greenC, OUTPUT);

pinMode (redD, OUTPUT);


pinMode (yellowD, OUTPUT);
pinMode (greenD, OUTPUT);
}

void loop() {
digitalWrite(greenA, HIGH);
digitalWrite(redB, HIGH);
digitalWrite(redC, HIGH);
digitalWrite(redD, HIGH);
delay(9000);

digitalWrite(greenA, LOW);
digitalWrite(redB, LOW);

digitalWrite(yellowA, HIGH);
digitalWrite(yellowB, LOW);
delay(1000);

digitalWrite(yellowA, LOW);
digitalWrite(yellowB, HIGH);

digitalWrite(redA, HIGH);
digitalWrite(greenB, HIGH);
delay(5000);

digitalWrite(greenB, LOW);
digitalWrite(redC, LOW);

digitalWrite(yellowB, HIGH);
digitalWrite(yellowC, LOW);
delay(1000);

digitalWrite(yellowB, HIGH);
digitalWrite(yellowC, LOW);

digitalWrite(redB, HIGH);
digitalWrite(greenC, HIGH);
digitalWrite(redD, HIGH);
delay(5000);

digitalWrite(greenC, LOW);
digitalWrite(redD, LOW);

digitalWrite(yellowC, LOW);
digitalWrite(yellowD, HIGH);
delay(1000);

digitalWrite(yellowC, HIGH);
digitalWrite(yellowD, LOW);

digitalWrite(redC, HIGH);
digitalWrite(yellowD, LOW);
delay(5000);

digitalWrite(redC, LOW);
digitalWrite(greenD, LOW);
digitalWrite(redA, LOW);

digitalWrite(yellowA, HIGH);
digitalWrite(yellowD, LOW);
delay(1000);

digitalWrite(yellowA, HIGH);
digitalWrite(yellowD, LOW);
}

You might also like