lunes, 14 de mayo de 2018

semaforo conmutado



 
int leds[]={3,4,5,6,7,8};//semaforo 1 y 2 (rojo, amarillo, verde)
int tiempo1=3000;
int tiempo2=500;
int n;
void setup() {
for (n=0;n<6;n++) {
pinMode (leds[n],OUTPUT);
}}

void secuencia(){
digitalWrite (leds[1],LOW);//amarillo1 off 
digitalWrite (leds[0],HIGH);//rojo1 on
digitalWrite (leds[3],LOW);//rojo2 off
digitalWrite (leds[5],HIGH);//verde2 on
delay (tiempo1);
digitalWrite (leds[5],LOW);//verde2 off
digitalWrite (leds[4],HIGH);//amarillo2 on
delay (tiempo2);
digitalWrite(leds[0],LOW);//rojo1 off
digitalWrite (leds[2],HIGH);//verde1 on
digitalWrite (leds[4],LOW);//amarillo2 off
digitalWrite (leds[3],HIGH);//rojo2 on
delay (tiempo1);
digitalWrite (leds[2],LOW);//verde1 off
digitalWrite(leds[1],HIGH);//amarillo on
delay (tiempo2);
}

void loop () {
  secuencia();

}
Explicación: Gracias a la placa de arduino hemos podido imitar un cruce de semáforos, el semáforo de los peatones y el de los coches, es decir, cuando el de los peatones está en rojo, el de los coches en verde y viceversa. Para hacer este cruce de semáforos, necesitaremos una placa arduino, una placa protoboard, 6 leds y 7 cables

lunes, 7 de mayo de 2018

coche fantastico Arduino

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);                       // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);                       // wait for a second
  digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(12, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
  digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);                       // wait for a second
  digitalWrite(11, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);    
}
Explicación: Gracias al programa de arduino hemos podido imitar las luces de un coche fantástico, estas luces hacen el movimiento de un cortina, se hace hacia ambos lados. El material que usamos ha sido: tres bombillas de colores (preferiblemente usar más de tres y todas del mismo color), siete cables para unirlo todo a la placa arduino y por último una placa protoboard.

domingo, 6 de mayo de 2018

Semaforo Arduino



// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);                       // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);                       // wait for a second
  digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(12, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
  digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);                       // wait for a second
  digitalWrite(11, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);    
}
Explicación: Gracias al programa de arduino hemos podido imitar las luces de un semáforo (rojo, ámbar y verde). Para ello se necesitaran tres bombillas de colores (preferiblemente rojo verde y amarillo), siete cables para conectarlo todo a la placa de arduino y por último una placa protoboard.



Pulsador led 5 segundos

nt pulsador=2; int led=3; int ld=4; void setup() {   pinMode (pulsador,INPUT);    pinMode (led,OUTPUT);   digitalWrite (led,H...