PRACTICA 2
TRABAJANDO CON ARDUINO
EJERCICIO 1
Energizar un Led por medio de un pulsador usando Arduino
como fuente de alimentación.
MATERIALES
1 Placa de Arduino
1 Pulsador
1 Led
1 Resistencia de 220 Ohms (rojo-rojo-marron)
1 ProtoBoard
Cables de conexión
ESQUEMA DE UN PULSADOR
ESQUEMA DE CONEXIÓN
EJERCICIO 2
Consiste en encender 6 (seis) leds en forma secuencial del 1 al
seis para posteriormente encenderlos del 5 al dos.
MATERIALES
1 Tarjeta Arduino
6 leds rojos
6 resistencias de 220 Ohms
ESQUEMA DE CONEXIÓN
DETALLE DE CONEXIÓN DE LOS PINES
DETALLE DE CONEXIÓN DE LOS RESISTORES
PROGRAMACIÓN
int i;
void setup() {
for(i=1;i<=6;i++){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
}
PROGRAMACIÓN
void loop() {
for(i=1;i<=6;i++){
digitalWrite(i, HIGH);
delay(200);
digitalWrite(i, LOW);
//delay(300);
}
for(i=5;i>=2;i--){
digitalWrite(i,HIGH); //encendemos el led i ...
delay(200); //durante 0,1 s ...
digitalWrite(i,LOW); //y luego lo apagamos
}
}