miércoles, 13 de junio de 2018

Pulsador led 5 segundos

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

void loop() {
  {
    digitalWrite(led,HIGH);
    if (digitalRead(pulsador)(delay(5000);==LOW);
                     
  }
  else{
    digitalWrite(led,LOW);
  }
}
Explicación: en esta practica hemos encendido un led al pulsar el pulsador, el led se enciende cuando pulsas y se mantiene encendido durante 5 segundos, para ello necesitaremos un placa protoboard, un placa arduino, un pulsador, un led, dos resistencias y 5 cables.

domingo, 3 de junio de 2018

led con pulsador


int pulsador=2;
int led=3;
void setup() {
  pinMode (pulsador,INPUT); 
  pinMode (led,OUTPUT);
  digitalWrite (led,LOW);
}

void loop() {
  if (digitalRead(pulsador)==HIGH){
    digitalWrite(led,HIGH);
  }
  else{
    digitalWrite(led,LOW);
  }
}

Explicación: en esta práctica con Arduino, hemos conseguido encender un led cuando pulsábamos un pulsador, para ello hemos usado: una placa protoboard, una placa arduino, cinco cables, un led un pulsador y dos resistencias. Para que funcione necesitaremos escribir todo lo que hay mas arriba en la aplicación de Arduino.


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.



martes, 24 de abril de 2018

Parpadeo led pin 13




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

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(2000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(2000);                       // wait for a second
}

EXPLICACIÓN: Hoy en la clase de TIC hemos hecho un parpadeo led a través del pin 13 en una placa Arduino uno, esto es gracias al código abierto que esta copiado arriba.
Según el delay que pongas tarda mas o menos en parpadear y el parpadeo,si pones un número muy pequeño como 100 casi ni se percibe que se apaga y se enciende.


Pulsador led 5 segundos

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