int switchstate = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
// Esto es un comentario
switchstate = digitalRead(2);
if (switchstate == LOW) {
// El botón no está apretado
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
}
else { // El botón está presionado
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
// wait for a quarter second before changing the light
delay(250);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
// wait for a quarter second before changing the light
delay(250);
}
} //vuelta al principio del bucle loop
//
int switchstate = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
// Esto es un comentario
switchstate = digitalRead(2);
if (switchstate == LOW) {
// El botón no está apretado
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
}
else { // El botón está presionado
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
// wait for a quarter second before changing the light
delay(250);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
// wait for a quarter second before changing the light
delay(50);
}
} //vuelta al principio del bucle loop
//
int switchstate = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
// Esto es un comentario
switchstate = digitalRead(2);
if (switchstate == LOW) {
// El botón no está apretado
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
}
else { // El botón está presionado
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
// wait for a quarter second before changing the light
delay(50);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
// wait for a quarter second before changing the light
delay(50);
}
} //vuelta al principio del bucle loop
//
int switchstate = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
// Esto es un comentario
switchstate = digitalRead(2);
if (switchstate == LOW) {
// El botón no está apretado
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
}
else { // El botón está presionado
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
// wait for a quarter second before changing the light
delay(10);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
// wait for a quarter second before changing the light
delay(10);
}
} //vuelta al principio del bucle loop
//
int switchstate = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
// Esto es un comentario
switchstate = digitalRead(2);
if (switchstate == LOW) {
// El botón no está apretado
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
}
else { // El botón está presionado
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
// wait for a quarter second before changing the light
delay(100);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
// wait for a quarter second before changing the light
delay(10);
}
} //vuelta al principio del bucle loop
No hay comentarios:
Publicar un comentario