Paso 1: Luces Trafik
int led2 = 2;
led3 int = 3; int del = 1000; led4 int = 4; led5 int = 5; led6 int = 6; led7 int = 7; led8 int = 8; led9 int = 9; led10 int = 10;
la puesta en marcha ejecuta rutina una vez al presionar reset:
void setup () {/ / inicializar el pin digital como oupput.
pinMode (led2, salida); pinMode (led3, salida); pinMode (led4, salida); pinMode (led5, salida); pinMode (led6, salida); pinMode (led7, salida); pinMode (led8, salida); pinMode (led9, salida); pinMode (led10, salida); } //the rutina de loop se ejecuta una y otra vez para siempre:
void loop() {}
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, LOW); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Todo rojo
digitalWrite (led2, LOW); digitalWrite (LED 3, bajo); digitalWrite (led4, HIGH); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Delay(del*2);
VERDE1
digitalWrite (led2, LOW); digitalWrite (LED 3, alto); digitalWrite (led4, LOW); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Delay(del);
YELLOW1
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Delay(del/2);
TODO ROJO
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, LOW); digitalWrite (led6, LOW); digitalWrite (led7, HIGH); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Delay(del*2);
VERDE 2
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, LOW); digitalWrite (led6, HIGH); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW); Delay(del);
YELLOW2
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, HIGH); digitalWrite (led9, LOW); digitalWrite (led10, LOW);
Delay(del/2);
TODO ROJO
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, LOW); digitalWrite (led9, LOW); digitalWrite (led10, HIGH);
Delay(2*del);
GREEEN2
digitalWrite (led2, HIGH); digitalWrite (LED 3, bajo); digitalWrite (led4, LOW); digitalWrite (led5, HIGH); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, LOW); digitalWrite (led9, HIGH); digitalWrite (led10, LOW);
Delay(del);
YELLOW3
}