You are on page 1of 80

MANUAL DE ARDUINO-

INSTRUMENTACION
VIRTUAL
Fernando Zavala Gonzlez

OBJETIVO
En esta primer practica se tiene como finalidad el asimilar
como es el funcionamiento de un Arduino desde el
programa y su lgica programable hasta de forma fsica
como son sus entradas y salidas para implementarse en
un circuito elctrico.
La funcin de este cdigo no es mas que la de prender
un LED y con la ayuda de los delays modular la
velocidad con la que enciende un LED.
Impresin de pantalla del cdigo
Ensamblado en fsico con el Arduino
CONCLUSION
Gracias a la funcin del cdigo, mas
especficamente del delay el LED
prende y a paga a 100mili segundos

OBJETIVO
Esta practica es muy precida a la uno lo nico que la
diferencia son los valores del delay , recordemos que
un delay equivale a milsimas de segundos
Impresin de pantalla del cdigo
Ensamblado en fsico con el Arduino
CONCLUSION
El objetivo de la practica fue cumplido ya
que el led prenda y apagaba cada 10
milisegundos que fue el valor preestablecido
en el cdigo.



OBJETIVO
Ya que aprendimos a usar el delay lo modificaremos a
nuertro gusto poniendo 1000 para el prenndido y 100 para
el apagado.
Impresin de pantalla del cdigo
CONCLUSION
El delay no solo sirve para apagar y prender el led lo mas
rpido posible sino que tambin nos sirve para
intercambiarlos, es decir puedo prender mas rpido y que
se apague mas lento.

OBJETIVO
En esta practica se le asigna a el delay dos tiempos
diferentes, tanto en el apagado como en el encendido,
cada uno con sus respectivos valores (100) y (1000).
Impresin de pantalla del cdigo
Ensamblado en fsico con el Arduino, el led
se puede conectar directo o con el uso del
protoboard

CONCLUSION
La practica se concluyo
de forma satisfactoria.


OBJETIVO
Realizar un programa que encienda y apague un led con
una velocidad de 1000 microsegundos .
CODIGO DEL ARDUINO
/*
Blink
Turns on an LED on for one second, then off for
one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino
boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}



// the loop routine runs over and over
again forever:
void loop() {

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second


digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second




digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

/* aqui se queda encendido*/


digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(10000); // wait for a second
// wait for a second


/* aqui inicia el conteo */


digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second


digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn
the LED on (HIGH is the voltage
level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn
the LED off by making the voltage
LOW
delay(1000); // wait for a
second

digitalWrite(led, HIGH); // turn
the LED on (HIGH is the voltage
level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn
the LED off by making the voltage
LOW
delay(1000); // wait for a
second

digitalWrite(led, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn the
LED off by making the voltage LOW
delay(1000); // wait for a
second

digitalWrite(led, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn the
LED off by making the voltage LOW
delay(1000); // wait for a second


digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making
the voltage LOW
delay(1000); // wait for a second

/* aqui se apaga */

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(10000); // wait for a second
Ensamblado en fsico con el Arduino
CONCLUSION
En la prctica de forma fsica
pude observar que el led
enciende 10 veces y despus
apaga.
Esto quiere decir que el
tiempo que le asignamos en el
programa se cumpli.

OBJETIVO
Se pedir en esta practica que el programa de 20 pulsos
en led y se queda encendido, tambin que cuando se
encienda parpadee 1000 veces y cuando acabe de igual
forma.
CDIGO ARDUINO
/*
Blink
Turns on an LED on for one second, then off for
one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino
boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}



// the loop routine runs over and over again forever:
void loop() {

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage
level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage
level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage
level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second


digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second


digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second

/* aqui inicia el conteo */


digitalWrite(led, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn the
LED off by making the voltage LOW
delay(1000); // wait for a
second

digitalWrite(led, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn the
LED off by making the voltage LOW
delay(1000); // wait for a
second


digitalWrite(led, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second



digitalWrite(led, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second

/* aqui se apaga */

digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(10000); // wait for a second
Ensamblado en fsico con el Arduino
CONCLUSION
El parpadeo de los leds se llevo de forma
correcta por lo que el programa no tuvo
error.

OBJETIVO
En esta prctica se encender el led con la ayuda de los
delays.
CODIGO ARDUINO
const int led = 13; //led pata 13
void setup ()
{
pinMode (led, OUTPUT); // Digital, como salida
}

void loop ()
{
digitalWrite (led, HIGH); //ON
delay(2000); //espera
digitalWrite (led, LOW); //OFF
delay(250); //ESPERA


digitalWrite (led, HIGH); //ON
delay(1000); //espera
digitalWrite (led, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led, HIGH); //ON
delay(100); //espera
digitalWrite (led, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led, HIGH); //ON
delay(10); //espera
digitalWrite (led, LOW); //OFF
delay(250); //ESPERA
CONCLUSION
El arduino trabaja de forma correcta con
el encendi del led.
Ensamblado en fsico con el Arduino

OBJETIVO
El objetivo de esta practica es que tengamos diferentes
salidas tales como la 13 y 12 y se realiza una secuencia
de encendido de delay 2000.
CODIGO ARDUINO
/*
Blink
Turns on an LED on for one second, then off for one
second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino
boards.
// give it a name:
int led = 13;
int led2 = 12;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second
pinMode(led2,OUTPUT);


digitalWrite(led2, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by
making the voltage LOW
delay(10); // wait for a second
}
CONCLUSION
El parpadeo del led fue el establecido y
las entradas y salidar son la 13 y12.

Ensamblado en fsico con el Arduino

OBJETIVO
El objetivo de esta practica es hacer una secuencia de
encendido donde se utilizan 5 led y su funcin es un
encendido de 1000 milisegundos y un apagado de 1000
milisegundos
CODIGO ARDUINO
/*
Blink
Turns on an LED on for one second, then off for one
second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino
boards.
// give it a name:
const int led1 = 13;
const int led2 = 12;
const int led3 = 8;
const int led4 = 7;
const int led5 = 4;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
pinMode (led1, OUTPUT);

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led2, OUTPUT);

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led3, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by
making the voltage LOW
delay(1000);
pinMode (led4, OUTPUT);

digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by
making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT);
}
Ensamblado en fsico con el Arduino
CONCLUSION
La secuencia de leds prendi de la manera
ordenada que se le notifico por lo que la
practica quedo completa.

OBJETIVO
El objetivo es hacer una secuencia de encendido donde
se utilizan 5 led y su funcin es un encendido de 1000
milisegundos y un apagado de 1000 milisegundos donde
se realiza de forma ordena con la ayuda de un Arduino
CODIGO ARDUINO
/*
Blink
Turns on an LED on for one second, then
off for one second, repeatedly.

This example code is in the public
domain.
*/

// Pin 13 has an LED connected on most
Arduino boards.
// give it a name:
const int led1 = 13;
const int led2 = 12;
const int led3 = 8;
const int led4 = 7;
const int led5 = 4;

// the setup routine runs once when you
press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by
making the voltage LOW
delay(1000); // wait for a second
pinMode (led5, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by
making the voltage LOW
delay(1000);
pinMode (led4, OUTPUT);


digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led3, OUTPUT);

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led2, OUTPUT);

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led1, OUTPUT);
}
Ensamblado en fsico con el Arduino
CONCLUSION
La cadena de leds prende de forma
ordenada secuencialmente.

OBJETIVO
En esta prctica y es una secuencia de encendido donde
se utilizan 5 led y su funcin es un encendido de 1000
milisegundos y un apagado de 1000 milisegundos donde
su secuencia es de encender uno si y uno n.
CODIGO ARDUINO

/*
Blink
Turns on an LED on for one second, then off
for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most
Arduino boards.
// give it a name:
int led = 4;
int led2 = 8;
int led3 = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH
is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by
making the voltage LOW
delay(10); // wait for a second


digitalWrite(led2, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by
making the voltage LOW
delay(10);

digitalWrite(led3, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by
making the voltage LOW
delay(10);
}
Ensamblado en fsico con el Arduino
CONCLUSION
El arduino trabaja de forma correcta con
el encendi de uno si y otro no.

OBJETIVO
En esta prctica es una secuencia de encendido donde
se utilizan 5 led y su funcin es un encendido de 1000
milisegundos y un apagado de 1000 milisegundos donde
su secuencia es de encender uno si y uno no(igual a la 11
solo cambian 1-3-5 a 5-3-1).
CODIGO ARDUINO
/*
Blink
Turns on an LED on for one second, then off
for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most
Arduino boards.
// give it a name:
int led = 13;
int led2 = 8;
int led3 = 4;


// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait for a second

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(10);

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(10);
}
Ensamblado en fsico con el Arduino
CONCLUSION
El arduino trabaja de
forma correcta con el
encendi de uno si y
otro no.


OBJETIVO
Esta practica consiste en incluir de la practica 9 a la 11 .
CODIGO ARDUINO

const int led1 = 13;
const int led2 = 12;
const int led3 = 8;
const int led4 = 7;
const int led5 = 4;

// La rutina de instalacin se ejecuta una
vez al presionar reinicio:
void setup() {
// inicializar el pin digital como salida.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}


//la rutina bucle se ejecuta una y otra vez
para siempre:
void loop() {
digitalWrite(led1, HIGH); // Enciende el
LED (ALTA es el nivel de tensin)
delay(1000); // esperar un
segundo
digitalWrite(led1, LOW); // apagar el
LED por lo que la tensin BAJA
delay(1000); // esperar un
segundo
pinMode (led1, OUTPUT);

digitalWrite(led2, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the
LED off by making the voltage LOW
delay(1000);
pinMode (led2, OUTPUT);




digitalWrite(led3, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off
by making the voltage LOW
delay(1000);
pinMode (led3, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led4, LOW); // turn the LED off
by making the voltage LOW
delay(1000);
pinMode (led4, OUTPUT);
digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off
by making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT);
//practica 10.

digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off
by making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led4, LOW); //
turn the LED off by making the
voltage LOW
delay(1000);
pinMode (led4, OUTPUT);

digitalWrite(led3, HIGH); //
turn the LED on (HIGH is the
voltage level)
delay(1000); // wait
for a second
digitalWrite(led3, LOW); //
turn the LED off by making the
voltage LOW
delay(1000);
pinMode (led3, OUTPUT);
digitalWrite(led2, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led2, LOW); // turn the
LED off by making the voltage LOW
delay(1000);
pinMode (led2, OUTPUT);

digitalWrite(led1, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led1, LOW); // turn the
LED off by making the voltage LOW
delay(1000); // wait for a
second
pinMode (led1, OUTPUT);

//practica 11.

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT);

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led3, OUTPUT);


digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
pinMode (led1, OUTPUT);


//practica 12.

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
pinMode (led1, OUTPUT);

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led3, OUTPUT);

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT);

}
Ensamblado en fsico con el Arduino
CONCLUSION
En programa funciona
bien con los tiempos
del delay y la cadena.

OBJETIVO
El programa hace , y es una secuencia de encendido
donde se utilizan 5 led y su funcionamiento es juntar las
practicas mencionadas anteriormente y llevarlas a cabo
CODIGO ARDUINO
const int led1 = 13;
const int led2 = 12;
const int led3 = 8;
const int led4 = 7;
const int led5 = 4;

// the setup routine runs once when you
press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}


// the loop routine runs over and over
again forever:
void loop() {
digitalWrite(led1, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(100); // wait for a
second
digitalWrite(led1, LOW); // turn the
LED off by making the voltage LOW
delay(100); // wait for a
second
pinMode (led1, OUTPUT);

digitalWrite(led2, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(100); // wait for a
second
digitalWrite(led2, LOW); // turn the
LED off by making the voltage LOW
delay(100);
pinMode (led2, OUTPUT);


digitalWrite(led3, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the
voltage LOW
delay(100);
pinMode (led3, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(100); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by making the
voltage LOW
delay(100);
pinMode (led4, OUTPUT);

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the
voltage LOW
delay(100);
pinMode (led5, OUTPUT);

//practica 10.

digitalWrite(led5, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by
making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);

digitalWrite(led4, HIGH); // turn the LED on (HIGH is
the voltage level)
delay(100); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by
making the voltage LOW
delay(100);
pinMode (led4, OUTPUT);


digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led2, OUTPUT);

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);
//practica 11.

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);


digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);




//practica 12.
digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);

}
Ensamblado en fsico con el Arduino
CONCLUSION
En los pines 13, 12, 8, 7, 4 se cargan las secuencias que
se van a realizar con 5 led, manteniendo el delay ( ms
rpido o entre ms tenga es ms lento el anterior fue de
1000 en encendido y apagado 1000).

OBJETIVO
El objetivo de esta prctica es el de habilitar los pines 13,
12, 8, 7, 4 y unimos las practicas anteriores de la 9 a la 12
donde las secuencias se van a realizar con 5 led, la
practica 9 es una secuencia con 5 led donde van a
encender de forma ordenada de izquierda a derecha.
CODIGO ARDUINO
const int led1 = 13;
const int led2 = 12;
const int led3 = 8;
const int led4 = 7;
const int led5 = 4;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
for (int i=0; i<=9;i++)
{
digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led2, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led4, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led4, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);
}
//practica 10.
for (int i=0; i<=9;i++)
{
digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by
making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led4, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by
making the voltage LOW
delay(100);
pinMode (led4, OUTPUT);
}

for (int i=0; i<=9;i++)
{
digitalWrite(led3, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off
by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led2, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off
by making the voltage LOW
delay(100);
pinMode (led2, OUTPUT);
}

for (int i=0; i<=9;i++)
{
digitalWrite(led1, HIGH); // turn
the LED on (HIGH is the voltage
level)
delay(100); // wait for a
second
digitalWrite(led1, LOW); //
turn the LED off by making the
voltage LOW
delay(100); // wait for a
second
pinMode (led1, OUTPUT);
}
//practica 11.
for (int i=0; i<=9;i++)
{
digitalWrite(led5, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by
making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);
}
//practica 12.
for (int i=0; i<=9;i++)
{
digitalWrite(led1, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by
making the voltage LOW
delay(100); // wait for a second
pinMode (led1, OUTPUT);
}
for (int i=0; i<=9;i++)
{

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led3, OUTPUT);
}
for (int i=0; i<=9;i++)
{
digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(100);
pinMode (led5, OUTPUT);
}
}
CONCLUSION
En secuencial de
leds prende de la
forma estipulada.
Ensamblado en fsico con el Arduino

OBJETIVO
Se realiza un rayo de luz, o ms poticamente, una
estrella fugaz, movindose a travs de una lnea de LED-
s. Podremos configurar tanto la velocidad de la estrella,
as como la longitud de la cola utilizando los delays
CODIGO ARDUINO
int pinArray [] = { 2,3,4,5,6,7,8,9,10,11,12 };
int controlLed = 13; // LED de control
int waitNextLed = 100; // Tiempo antes de encender el siguiente LED
// Nmero de LED-s que permanecen encendidos antes de empezar a
apagarlos para
//formar la cola
int tailLength = 4;
// Nmero de LED-s conectados (que es tambin el tamao del array)
int lineSize = 11;
void setup() // Configuracin de los PIN-es como salida digital
{
int i;
pinMode (controlLed, OUTPUT);
for (i=0; i< lineSize; i++)
{
pinMode(pinArray[i], OUTPUT);
}
}
void loop()
{
int i;
// Se establece la longitud
de la cola en un contador
int tailCounter = tailLength;
// Se enciende el LED de
control para indicar el inicio
del loop
digitalWrite(controlLed,
HIGH);
for (i=0; i<lineSize; i++)
{
digitalWrite(pinArray[i],HIG
H); // Se encienden
consecutivamente los LED
// Esta variable de tiempo
controla la velocidad a la
que se mueve la estrella
delay(waitNextLed);
if (tailCounter == 0)
{
// Se apagan los LED-s en
funcin de la longitud de
la cola.
digitalWrite(pinArray[i-
tailLength],LOW);
}
else
if (tailCounter > 0)
tailCounter--;
}
for (i=(lineSize-tailLength);
i<lineSize; i++)
{
digitalWrite(pinArray[i],LO
W); // Se apagan los LED
// Esta variable de tiempo
controla la velocidad a la
que se mueve la estrella
delay(waitNextLed);
}
}
COCLUSION
Se puede observar el
funcionamiento del programa
imitando una estrella fugaz,
es decir el tiempo en que los
led prenden es muy rpido.

Ensamblado en fsico con el Arduino

OBJETIVO
Se realiza la practica 10 solo que esta vez se le aadirn
mas leds y los tiempos de delay cambiaran para que aun
siga pareciendo una estrella fugas.
CODIGO ARDUINO
int controlLed = 13; // LED de control
int waitNextLed = 100; // Tiempo antes
de encender el siguiente LED
// Nmero de LED-s que permanecen
encendidos antes de empezar a
apagarlos para
//formar la cola
int tailLength = 4;
// Nmero de LED-s conectados (que
es tambin el tamao del array)
int lineSize = 11;
void setup() // Configuracin de los
PIN-es como salida digital
{
int i;
pinMode (controlLed, OUTPUT);
for (i=0; i< lineSize; i++)
{
pinMode(pinArray[i], OUTPUT);
}
}
void loop()
{
int i;
// Se establece la longitud de la cola en un
contador
int tailCounter = tailLength;
// Se enciende el LED de control para indicar
el inicio del loop
digitalWrite(controlLed, HIGH);
for (i=0; i<lineSize; i++)
{
digitalWrite(pinArray[i],HIGH); // Se
encienden consecutivamente los LED
// Esta variable de tiempo controla la
velocidad a la que se mueve la estrella
delay(waitNextLed);
if (tailCounter == 0)
{
// Se apagan los LED-s en funcin de
la longitud de la cola.
digitalWrite(pinArray[i-
tailLength],LOW);
}
else
if (tailCounter > 0)
tailCounter--;
}
for (i=(lineSize-tailLength); i<lineSize;
i++)
{
digitalWrite(pinArray[i],LOW); // Se
apagan los LED
// Esta variable de tiempo controla la
velocidad a la que se mueve la estrella
delay(waitNextLed);
}
}
CONCLUSIN
El cdigo hace que en
forma fsica los leds
imiten una serie muy
parecida a una
estrella fugas.
Ensamblado en fsico con el Arduino

OBJETIVO
Esta prctica se adjuntan las practicas 13 y 17(que es un
conjunto de todas las practicas).
CODIGO ARDUINO
const int led1 = 13; //LED pata 13
const int led2 = 12; //LED pata 12
const int led3 = 11; //LED pata 11
const int led4 = 10; //LED pata 10
const int led5 = 9; //LED pata 9
int pinArray [] = { 3,4,5,6,7,8,9,10,11,12,13,12,11,10,9,8,7,6,5,4,3};
int controlLed = 3; // LED de control
int waitNextLed = 100; // Tiempo antes de encender el siguiente LED
// Nmero de LED-s que permanecen encendidos antes de empezar a
apagarlos para
//formar la cola
int tailLength = 3;
// Nmero de LED-s conectados (que es tambin el tamao del array)
int lineSize = 22;
void setup ()
{
pinMode (led1, OUTPUT); //Digital, como salida
pinMode (led2, OUTPUT); //Digital, como salida
pinMode (led3, OUTPUT); //Digital, como salida
pinMode (led4, OUTPUT); //Digital, como salida
pinMode (led5, OUTPUT); //Digital, como salida
int i;
pinMode (controlLed, OUTPUT);
for (i=0; i< lineSize; i++)
{
pinMode(pinArray[i], OUTPUT);
}
}
void loop ()
{


//pract 9

digitalWrite (led1, HIGH); //ON
delay(1000); //espera
digitalWrite (led1, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led2, HIGH); //ON
delay(1000); //espera
digitalWrite (led2, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led3, HIGH); //ON
delay(1000); //espera
digitalWrite (led3, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led4, HIGH); //ON
delay(1000); //espera
digitalWrite (led4, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led5, HIGH); //ON
delay(1000); //espera
digitalWrite (led5, LOW); //OFF
delay(250); //ESPERA


//pract10

digitalWrite (led5, HIGH); //ON
delay(1000); //espera
digitalWrite (led5, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led4, HIGH); //ON
delay(1000); //espera
digitalWrite (led4, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led3, HIGH); //ON
delay(1000); //espera
digitalWrite (led3, LOW); //OFF
delay(250); //ESPERA


digitalWrite (led2, HIGH); //ON
delay(1000); //espera
digitalWrite (led2, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led1, HIGH); //ON
delay(1000); //espera
digitalWrite (led1, LOW); //OFF
delay(250); //ESPERA

//pract 11

digitalWrite (led5, HIGH); //ON
delay(1000); //espera
digitalWrite (led5, LOW); //OFF
delay(250); //ESPERA
digitalWrite (led3, HIGH); //ON
delay(1000); //espera
digitalWrite (led3, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led1, HIGH); //ON
delay(1000); //espera
digitalWrite (led1, LOW); //OFF
delay(250); //ESPERA

digitalWrite (led1, HIGH); //ON
delay(1000); //espera
digitalWrite (led1, LOW); //OFF
delay(250); //ESPERA
//pract12

digitalWrite (led3, HIGH); //ON
delay(1000); //espera
digitalWrite (led3, LOW); //OFF
delay(250); //ESPERA



digitalWrite (led5, HIGH); //ON
delay(1000); //espera
digitalWrite (led5, LOW); //OFF
delay(250); //ESPERA

int i;
// Se establece la longitud de la cola en un contador
int tailCounter = tailLength;
// Se enciende el LED de control para indicar el inicio del loop
digitalWrite(controlLed, HIGH);
for (i=0; i<lineSize; i++)
{
digitalWrite(pinArray[i],HIGH); // Se encienden consecutivamente
los LED
// Esta variable de tiempo controla la velocidad a la que se mueve
la estrella
delay(waitNextLed);
if (tailCounter == 0)
{
// Se apagan los LED-s en funcin de la longitud de la cola.
digitalWrite(pinArray[i-tailLength],LOW);
}
else
if (tailCounter > 0)
tailCounter--;
}
for (i=(lineSize-tailLength); i<lineSize; i++)
{
digitalWrite(pinArray[i],LOW); // Se apagan los LED
// Esta variable de tiempo controla la velocidad a la que se mueve
la estrella
delay(waitNextLed);
}
}
Ensamblado en fsico con el Arduino
COCLUSION
Se puede observar el
funcionamiento del programa
imitando una estrella fugaz, es
decir el tiempo en que los led
prenden es muy rpido, y
tambin las animaciones de la
prctica nmero 13.

You might also like