const int verdel - 13: 1/ Traffie light 1: treen pin const int anarelol - 11; // Traffic light 1: yellow pin const Int vernelhol - 12; // Traffic light 1: red pin
const Int verde2 - 10; // Traffic light 2: green pin const Int anarelo2 - 9; // Traffic light 21 yellow pin const Int verselho - 8; |/ Traffic light 2: red pin
const int verde3 - 7; 1/ Traffic light 3: green pin const int anarelo3 - 6; // Traffic Light 3: yellow pin const int vernelh03 - 5; // Traffic light 3: red pin
99.1 setup (
Pintoda(verdel, OUTPUT):
RAnkode(anarelo1, OUTPUT):
RAntiods(vernelho1, OUTPUT):
pinkade (verde2, OUTPUT):
Pintoda (amarelo2, OUTPUT):
Ristods(vernelho2, OUTPUT):
DinHode(verde3, OUTPUT):
Rintose (anarelo3, OUTPUT):
pineode (vernelho3, OUTPUT):
)
void trafficlightSequence(int delayTine, int redStates, int yellowStatel, int greenStatel,
int redstate2, int yellowstate?, int greenstatez, Int redState3, Int yellowState), int greenstates) (
digitalbotte(verselhol, redStates);
dig{talMelte(anarelo1, yellowstatel);
Si&{talucAte(verdel, greenstatel):
Lettalucte(vernelhoz, redstate2);
StairalMc|ta(anarelo2, yellouState?);
digitalMoite(verdez, greenState?);
distrele(te(vernelho3, redstate3);
diettalHolte(anarelo, yellowstate3):
digitalurite(verde), greenstate?):
delay (delayTine):
void 10000) (
// Traffic light 1 sequence
Sceff/cLehtSeguense(3000, LOW, LOM,
HICH, HIGH, LOM, LOM, HIGH, LOM, LOM): // Green
seafficlinhtSeguence(250, LOM, HIGH,
HICH, HIGH, HIGH, LOM, HIGH, NICH, LOW);
/7 Yellow
ScaffickishtSeeuence (250, HIGH, LOW,
LOM, HIGH, LOM, LOM, LOM, HIGH, HIGH): /7
Red
// Traffic light 2 sequence
ScaffcLetSeauence(3000, HIGH, LOW,
LON, LOM, LOM, HIGH, HIGH, LOW, LOW); /1
Green
grafttch fahtStguence (250, HIGH, HIGH,
LOM, NICH, HIGH, LOM, HIGH, HIGH, LOW); 1/ Yellow
traffickihtSeguence (250, HIGH, LOW, LOM, LOM, HIGH, HIGH, LOM, HIGH, HIGH): /1
// Traffic light 3 sequence
ScafftcLichtScastase(3000, HIGH, LOM,
LOM, HICH, LOM, LOM, LOM, LOM, HIGH): 1/ Green
scatticLicht§caucase(250, HIGH, HIGH,
LOM, HIGH, HICH, LOM, HICH, LOM, HIGH): // Yellow
ScaffAcLahtStautaca(250, HICH, LOM,
LOM, KICH, LOM, LOM, HIGH, LOM, HIGH): /7
To embed this program on your website, copy the following code and paste it into your website's HTML: