Post on 02-Jun-2018
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
1/80
MANUAL DE ARD
INSTRUMENTAVIR
Fernan
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
2/80
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.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
3/80
Impresin de pantalla del cdigo
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
4/80
Ensamblado en fsico con el Arduino
CONCLUSION
Gracias a la funcin del c
especficamente del delay
prende y a paga a 100mili
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
5/80
OBJETIVO
Esta practica es muy precida a la uno lo nico que ladiferencia son los valores del delay , recordemos queun delay equivale a milsimas de segundos
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
6/80
Impresin de pantalla del cdigo
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
7/80
Ensamblado en fsico con el Arduino
CONCLUSION
El objetivo de la practica fue cum
que el led prenda y apagaba cad
milisegundos que fue el valor pre
en el cdigo.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
8/80
OBJETIVOYa que aprendimos a usar el delay lo modificaremos a
nuertro gusto poniendo 1000 para el prenndido y 100 para
el apagado.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
9/80
Impresin de pantalla del cdigo
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
10/80
CONCLUSION
El delay no solo sirve para apagar y prender el led lo masrpido posible sino que tambin nos sirve para
intercambiarlos, es decir puedo prender mas rpido y que
se apague mas lento.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
11/80
OBJETIVOEn 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).
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
12/80
Impresin de pantalla del cdigo
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
13/80
Ensamblado en fsico con el Arduino, el ledse puede conectar directo o con el uso delprotoboard
CONCLUS
La practica
de forma sa
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
14/80
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
15/80
CODIGO DEL ARDUINO
/*
Blink
Turns on an LED on for one second, then off forone second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduinoboards.
// 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 runsagain forever:
void loop() {
digitalWrite(led, HIGon (HIGH is the voltag
delay(1000);
digitalWrite(led, LOWoff by making the volta
delay(1000);
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
16/80
digitalWrite(led, HIGH); // turn the LED on(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED offby 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 offby making the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // (HIGH is the voltage level)
delay(1000); // w
digitalWrite(led, LOW); /by making the voltage LOW
delay(1000); // wait for
digitalWrite(led, HIGH); /(HIGH is the voltage level)
delay(1000); // w
digitalWrite(led, LOW); /by making the voltage LOW
delay(1000); // w
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
17/80
digitalWrite(led, HIGH); // turn the LED on (HIGH is thevoltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by makingthe voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED on (HIGH is thevoltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by makingthe voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED on (HIGH is thevoltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by makingthe voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGHon (HIGH is the voltage
delay(1000);
digitalWrite(led, LOW)
off by making the voltagdelay(1000);
digitalWrite(led, HIGHon (HIGH is the voltage
delay(1000);
digitalWrite(led, LOW)off by making the voltag
delay(1000);
/* aqui se queda ence
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
18/80
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 thevoltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by makingthe voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED on (HIGH is thevoltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by makingthe voltage LOW
delay(1000); // wait for a second
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
19/80
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 bymaking 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 bymaking the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn
(HIGH is the voltage level)
delay(1000); // wait f
digitalWrite(led, LOW); // tuby making the voltage LOW
delay(1000); // wait f
digitalWrite(led, HIGH); // tur(HIGH is the voltage level)
delay(1000); // wait f
digitalWrite(led, LOW); // tuby making the voltage LOW
delay(1000); // wait f
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
20/80
digitalWrite(led, HIGH); // turn the LEDon (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LEDoff 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, HIG
the LED on (HIGH islevel)
delay(1000); second
digitalWrite(led, LOthe LED off by makinLOW
delay(1000); second
digitalWrite(led, HIG
the LED on (HIGH is
level)
delay(1000); second
digitalWrite(led, LO
the LED off by makinLOW
delay(1000); second
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
21/80
digitalWrite(led, HIGH); // turn theLED on (HIGH is the voltage level)
delay(1000); // wait for asecond
digitalWrite(led, LOW); // turn theLED off by making the voltage LOW
delay(1000); // wait for asecond
digitalWrite(led, HIGH); // turn theLED on (HIGH is the voltage level)
delay(1000); // wait for a
second
digitalWrite(led, LOW); // turn theLED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LEDvoltage level)
delay(1000); // wait for a secon
digitalWrite(led, LOW); // turn the LED
the voltage LOW
delay(1000); // wait for a secon
digitalWrite(led, HIGH); // turn the LED
voltage level)
delay(1000); // wait for a secon
digitalWrite(led, LOW); // turn the LEDthe voltage LOW
delay(1000); // wait for a secon
/* aqui se apaga */
digitalWrite(led, HIGH); // turn the LEvoltage level)
delay(10000); // wait for a seco
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
22/80
Ensamblado en fsico con el Arduino
CONCLUSION
En la prctica de
pude observar qu
enciende 10 vece
apaga.
Esto quiere decir
tiempo que le asi
programa se cum
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
23/80
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.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
24/80
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 a
void loop() {
digitalWrite(led, HIGH); // turn the LE
level)
delay(1000); // wait for a seco
digitalWrite(led, LOW); // turn the LE
voltage LOW
delay(1000); // wait for a seco
digitalWrite(led, HIGH); // turn the LE
level)
delay(1000); // wait for a secodigitalWrite(led, LOW); // turn the LE
voltage LOW
delay(1000); // wait for a seco
digitalWrite(led, HIGH); // turn the LE
level)delay(1000); // wait for a secodigitalWrite(led, LOW); // turn the LE
voltage LOW
delay(1000); // wait for a seco
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
25/80
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
26/80
/* aqui inicia el conteo */
digitalWrite(led, HIGH); // turn the
LED on (HIGH is the voltage level)
delay(1000); // wait for a
seconddigitalWrite(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 theLED off by making the voltage LOW
delay(1000); // wait for a
second
digitalWrite(led, HIGH); // turn the LED
the voltage level)
delay(1000); // wait for a secon
digitalWrite(led, LOW); // turn the LED
making the voltage LOW
delay(1000); // wait for a secon
digitalWrite(led, HIGH); // turn the LED
the voltage level)
delay(1000); // wait for a secon
digitalWrite(led, LOW); // turn the LEDmaking the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED
the voltage level)delay(1000); // wait for a secon
digitalWrite(led, LOW); // turn the LEDmaking the voltage LOW
delay(1000); // wait for a secon
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
27/80
digitalWrite(led, HIGH); // turn the LEDon (HIGH is the voltage level)
delay(1000); // wait for a seconddigitalWrite(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 seconddigitalWrite(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 seconddigitalWrite(led, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the
is the voltage level)
delay(1000); // wait for a
digitalWrite(led, LOW); // turn th
making the voltage LOW
delay(1000); // wait for a
digitalWrite(led, HIGH); // turn th
(HIGH is the voltage level)
delay(1000); // wait for a
digitalWrite(led, LOW); // turn th
making the voltage LOW
delay(1000); // wait for a
/* aqui se apaga */
digitalWrite(led, HIGH); // turn t(HIGH is the voltage level)delay(10000); // wait for
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
28/80
Ensamblado en fsico con el Arduino
CONCLUSION
El parpadeo de los leds se
correcta por lo que el progr
error.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
29/80
OBJETIVO
En esta prctica se encender el led con la ayuda de los
delays.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
30/80
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); //OFFdelay(250); //ESPERA
digitalWrite (led, HIGH); /
delay(1000); //espera
digitalWrite (led, LOW); //
delay(250); //ESPERA
digitalWrite (led, HIGH); /
delay(100); //espera
digitalWrite (led, LOW); //
delay(250); //ESPERA
digitalWrite (led, HIGH); /
delay(10); //esperadigitalWrite (led, LOW); //
delay(250); //ESPERA
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
31/80
CONCLUSION
El arduino trabaja de forma
el encendi del led.
Ensamblado en fsico con el Arduino
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
32/80
OBJETIVO
El objetivo de esta practica es que tengamos diferentessalidas tales como la 13 y 12 y se realiza una secuencia
de encendido de delay 2000.
CODIGO ARDUINO
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
33/80
/*
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 a
void loop() {
digitalWrite(led, HIGH); // turn the L
is the voltage level)
delay(1000); // wait for a sec
digitalWrite(led, LOW); // turn the L
making the voltage LOW
delay(1000); // wait for a second
pinMode(led2,OUTPUT);
digitalWrite(led2, HIGH); // turn the is the voltage level)
delay(100); // wait for a seco
digitalWrite(led2, LOW); // turn the
making the voltage LOW
delay(10); // wait for a second
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
34/80
CONCLUSIONEl parpadeo del led fue el elas entradas y salidar son la
Ensamblado en fsico con el Arduino
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
35/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
36/80
/*
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 w
void setup() {
// initialize the digital pin as a
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
// the loop routine runs over and over again forever:
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
37/80
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)
(HIGH is the voltage leve
delay(1000); //
digitalWrite(led4, LOW);
making the voltage LOW
delay(1000);
pinMode (led4, OUTPUT
digitalWrite(led5, HIGH)
(HIGH is the voltage leve
delay(1000); //
digitalWrite(led5, LOW);
making the voltage LOW
delay(1000);
pinMode (led5, OUTPUT
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
38/80
Ensamblado en fsico con el Arduino
CONCLUSION
La secuencia de leds prendi
ordenada que se le notifico ppractica quedo completa.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
39/80
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 dondese realiza de forma ordena con la ayuda de un Arduino
CODIGO ARDUINO
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
40/80
/*
Blink
Turns on an LED on for one second, then
off for one second, repeatedly.
This example code is in the publicdomain.
*/
// 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 run
press reset:
void setup() {
// initialize the digital p
pinMode(led1, OUTP
pinMode(led2, OUTP
pinMode(led3, OUTP
pinMode(led4, OUTP
pinMode(led5, OUTP
}
// the loop routine runs over and over again forever:
digitalWrite(led3, HIGH); // turn the LED on (H
delay(1000); // wait for a second
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
41/80
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 bymaking the voltage LOW
delay(1000);
pinMode (led4, OUTPUT);
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off b
delay(1000);
pinMode (led3, OUTPUT);
digitalWrite(led2, HIGH); // turn the LED on (H
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off b
delay(1000);
pinMode (led2, OUTPUT);
digitalWrite(led1, HIGH); // turn the LED on (H
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off b
delay(1000);
pinMode (led1, OUTPUT);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
42/80
Ensamblado en fsico con el Arduino
CONCLUSION
La cadena de leds pren
ordenada secuencialme
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
43/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
44/80
/*
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 yo
void setup() {
// initialize the digital pin as an output
pinMode(led, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
45/80
// 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 L
(HIGH is the voltage level)
delay(1000); // wait for a sec
digitalWrite(led2, LOW); // turn the
making the voltage LOW
delay(10);
digitalWrite(led3, HIGH); // turn the
(HIGH is the voltage level)
delay(1000); // wait for a sec
digitalWrite(led3, LOW); // turn the
making the voltage LOW
delay(10);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
46/80
Ensamblado en fsico con el Arduino
CONCLUSION
El arduino trabaja de for
el encendi de uno si y o
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
47/80
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).
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
48/80
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 fore
void loop() {
digitalWrite(led3, HIGH); // turn the LED on (H
delay(1000); // wait for a second
digitalWrite(led3, LOW); // turn the LED off b
delay(10); // wait for a second
digitalWrite(led2, HIGH); // turn the LED on (
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the LED off b
delay(10);
digitalWrite(led1, HIGH); // turn the LED on (
delay(1000); // wait for a second
digitalWrite(led1, LOW); // turn the LED off b
delay(10);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
49/80
Ensamblado en fsico con el Arduino
CONCLUS
El arduino tr
forma correencendi de
otro no.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
50/80
OBJETIVO
Esta practica consiste en incluir de la practica 9 a la 11 .
CODIGO ARDUINO
//la rutina bucle se ejecuta una y otra vez
digitalWrite(led3(HIGH is the volta
delay(1000);
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
51/80
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);
}
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 LEDon (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);
delay(1000);
digitalWrite(led3
by making the vo
delay(1000);
pinMode (led3,
digitalWrite(led4
(HIGH is the volta
delay(1000);
digitalWrite(led4
by making the vo
delay(1000);
pinMode (led4, digitalWrite(led
(HIGH is the volta
delay(1000);
digitalWrite(led5
by making the vo
delay(1000);
pinMode (led5,
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
52/80
//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 thevoltage LOW
delay(1000);
pinMode (led3, OUTPUT);
digitalWrite(le
LED on (HIGH
delay(1000);
second
digitalWrite(leLED off by ma
delay(1000);
pinMode (led
digitalWrite(le
LED on (HIGH
delay(1000); second
digitalWrite(le
LED off by ma
delay(1000);
second
pinMode (led
//practica 11.
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
53/80
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)
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
54/80
g ( ) ( g )
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);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
55/80
Ensamblado en fsico con el Arduino
CONCLUSIO
En programa f
bien con los ti
del delay y la
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
56/80
OBJETIVO
El programa hace , y es una secuencia de encendidodonde se utilizan 5 led y su funcionamiento es juntar las
practicas mencionadas anteriormente y llevarlas a cabo
CODIGO ARDUINO// the loop routine runs over and over
again forever:
digitalWrite(led3, HIGH); // t
voltage level)
delay(100); // wait fo
digitalWrite(led3 LOW); // t
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
57/80
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);
}
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, LOW); // t
voltage LOW
delay(100);
pinMode (led3, OUTPUT);
digitalWrite(led4, HIGH); // t
voltage level)
delay(100); // wait fo
digitalWrite(led4, LOW); // t
voltage LOW
delay(100);
pinMode (led4, OUTPUT);
digitalWrite(led5, HIGH); // t
voltage level)
delay(100); // wait fo
digitalWrite(led5, LOW); // t
voltage LOW
delay(100);
pinMode (led5, OUTPUT);
//practica 10. digitalWrite(led3, HIGH); // turn the LED on (H
d l (100) // i f d
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
58/80
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);
delay(100); // wait for a second
digitalWrite(led3, LOW); // turn the LED off b
delay(100);
pinMode (led3, OUTPUT);
digitalWrite(led2, HIGH); // turn the LED on
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off b
delay(100);
pinMode (led2, OUTPUT);
digitalWrite(led1, HIGH); // turn the LED on (
delay(100); // wait for a second
digitalWrite(led1, LOW); // turn the LED off b
delay(100); // wait for a second
pinMode (led1, OUTPUT);
//practica 11.
di it lW it (l d5 HIGH) // t th LED (HIGH i th lt l l)
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
59/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
60/80
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);
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
61/80
Ensamblado en fsico con el Arduino
CONCLUSION
En los pines 13, 12, 8, 7, 4 se carga
se van a realizar con 5 led, manten
rpido o entre ms tenga es ms le
1000 en encendido y apagado 1000
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
62/80
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.
delay(100); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(100);
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
63/80
pinMode (led2, OUTPUT);
}
for (int i=0; i
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
64/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
65/80
//practica 11.
for (int i=0; i
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
66/80
//practica 12.
for (int i=0; i
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
67/80
CONCLUSIO
En secuencial
leds prende deforma estipula
Ensamblado en fsico con el Arduino
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
68/80
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
int i;
// Se establece la longitud
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
69/80
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()
{
g
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
70/80
COCLUSION
Se puede observa
funcionamiento deimitando una estre
es decir el tiempo e
led prenden es mu
Ensamblado en fsico con el Arduino
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
71/80
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
pinMode(pinArray[i], OUTPUT);
}
}
// Se apagan los
la longitud de la
digitalWrite(pinA
t ilL th] LOW
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
72/80
; p
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++)
{
}
void loop()
{
int i;
// Se establece la longitud de la cola en uncontador
int tailCounter = tailLength;
// Se enciende el LED de control para indicar
el inicio del loop
digitalWrite(controlLed, HIGH);
for (i=0; i
tailCounter--;
}
for (i=(lineSize-
i++)
{
digitalWrite(pinA
apagan los LED
// Esta variable velocidad a la q
delay(waitNextL
}
}
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
73/80
CONCLUS
El cdigo ha
forma fsica
imiten una s
parecida a
estrella fuga
Ensamblado en fsico con el Arduino
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
74/80
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
{
pinMode (led1, OUTP
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
75/80
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 (led2, OUTP
pinMode (led3, OUTP
pinMode (led4, OUTP
pinMode (led5, OUTP
int i;
pinMode (controlLed, O
for (i=0; i< lineSize; i++
{
pinMode(pinArray[i], OU
}
}
void loop ()
{
//pract 9
digitalWrite (led1, HIGH); //ON
digitalWrite (led4 HIGH); //ON
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
76/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
77/80
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
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
78/80
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(pinArray[i],HIGH); // Se
los LED
// Esta variable de tiempo controla la
la estrella
delay(waitNextLed);
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
79/80
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 0)
tailCounter--;
}
for (i=(lineSize-tailLength); i
8/11/2019 MANUAL DE ARDUINO-instrumentacion virtual.pptx
80/80
Ensamblado en fsico con el Arduino
COCLUSION
Se puede obs
funcionamientimitando una e
decir el tiempo
prenden es mu
tambin las an
prctica nme