Tais Bustamante y Belen Rozas
BOCETO 1- Titilar un led (de la placa conectado al pin 13)
void setup() {
pinMode(13,OUTPUT);
}
void loop() {
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
BOCETO 2-Prender 4 segundos, apagar 3 segundos , prender 2 segundos y apagar 1 segundo.
void setup() {
// put your setup code here, to run once:
pinMode (2, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite (2, HIGH);
delay (4000);
digitalWrite (2, LOW);
delay (3000) ;
digitalWrite (2, HIGH);
delay(2000);
digitalWrite (2, LOW);
delay (1000) ;
BOCETO 3- 2 leds: prende 2, apaga 2 ,prende 3 y apaga 3.
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
}
void loop() {
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
delay(1000);
digitalWrite(3,HIGH);
delay(1000);
digitalWrite(3,LOW);
delay(1000); }
BOCETO 4- Los 2 leds tienen que prender simultáneamente
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
}
void loop() {
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
}
BOCETO 5- Semáforo.
void setup() {
// put your setup code here, to run once:
pinMode (2,OUTPUT);
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite (4, HIGH);
delay (4000);
digitalWrite (4 ,LOW);
delay (2000);
digitalWrite (3, HIGH);
delay (2000);
digitalWrite (3, LOW);
delay (2000);
digitalWrite (2, HIGH);
delay (4000);
digitalWrite (2, LOW);
delay (2000);
digitalWrite (3, HIGH);
delay (2000);
digitalWrite (3, LOW);
delay (2000);
}
0 comentarios:
Publicar un comentario