manual de arduino intrumentación virtual.docx

91
Ing. Mecatrónica Instrumentación virtual Practica N° 1 Ortega Morales Sabino de Jesús Grupo: 7M1

Upload: ryan-morgan

Post on 19-Jul-2016

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Manual de Arduino Intrumentación Virtual.docx

Ing. MecatrónicaInstrumentación

virtualPractica N° 1

Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEn esta primera práctica se tiene como finalidad el asimilar como es el funcionamiento de un Arduino desde el programa y su lógica programable hasta

Page 2: Manual de Arduino Intrumentación Virtual.docx

de forma física como son sus entradas y salidas para implementarse en un circuito eléctrico.

La función de este código no es más que la de prender un LED y con la ayuda de los “delays” modular la velocidad con la que enciende un LED.

PRACTICA N°1

CONCLUSION

Page 3: Manual de Arduino Intrumentación Virtual.docx

Gracias a la función del código, más específicamente del delay el LED prende y a paga a 100mili segundos.

Instrumentación virtual

Page 4: Manual de Arduino Intrumentación Virtual.docx

Practica N° 2Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEsta práctica es muy precisa a la uno lo único que la diferencia son los valores del delay , recordemos que un delay equivale a milésimas de segundos.

Page 5: Manual de Arduino Intrumentación Virtual.docx

COCLUSION

El objetivo de la práctica fue cumplido ya que el led prendía y apagaba cada 10 milisegundos que fue el valor preestablecido en el código. Se recomienda jugar con los valores para su mejor entendimiento en el código.

Page 6: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 3Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVO

Page 7: Manual de Arduino Intrumentación Virtual.docx

Ya que aprendimos a usar el delay lo modificaremos a nuestro gusto poniendo 1000 para el prendido y 100 para el apagado.

CONCLUSIÓNEl delay no solo sirve para apagar y prender el led lo más rápido posible sino que también nos sirve para intercambiarlos, es decir puedo prender más rápido y que se apague más lento.

Page 8: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 4Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEn esta práctica se le asigna el delay dos tiempos diferentes, tanto en el apagado como en el encendido, cada uno con sus respectivos valores (100) y (1000).

Page 9: Manual de Arduino Intrumentación Virtual.docx
Page 10: Manual de Arduino Intrumentación Virtual.docx

El led se puede conectar directo o con el uso del protoboard

CONCLUSIÓNLa práctica se concluyó de forma satisfactoria comprobando el funcionamiento de delay.

Page 11: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 5Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVORealizar un programa que encienda y apague un led con una velocidad de 1000 microsegundos.

CODIGO DEL ARDUINO

/* Blink

Page 12: Manual de Arduino Intrumentación Virtual.docx

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

Page 13: Manual de Arduino Intrumentación Virtual.docx

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

Page 14: Manual de Arduino Intrumentación Virtual.docx

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

Page 15: Manual de Arduino Intrumentación Virtual.docx

El led prende directamente conectado en el Arduino en el pin 13 y el grand

CONCLUSIONEn la práctica de forma física pude observar que el led enciende 10 veces y después apaga, logrando la efectividad del programa en arduino.

Esto quiere decir que el tiempo que le asignamos en el programa se cumplió.

Page 16: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 6Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOSe pedirá en esta práctica que el programa de 20 pulsos en led y se queda encendido, también que cuando encienda parpadea 1000 veces y cuando acabe de igual forma.

CÓDIGO ARDUINO

/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain.

Page 17: Manual de Arduino Intrumentación Virtual.docx

*/ // 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

Page 18: Manual de Arduino Intrumentación Virtual.docx

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

Page 19: Manual de Arduino Intrumentación Virtual.docx

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

}

Page 20: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIONEl parpadeo de los leds se llevó de forma correcta por lo que el programa no tuvo error.

Page 21: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 7Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEn esta práctica se encenderá el led con la ayuda de los delays.

CODIGO ARDUINO

const int led = 13; //led pata 13void setup ()

Page 22: Manual de Arduino Intrumentación Virtual.docx

{pinMode (led, OUTPUT); // Digital, como salida}

void loop (){digitalWrite (led, HIGH); //ONdelay(2000); //esperadigitalWrite (led, LOW); //OFFdelay(250); //ESPERA

digitalWrite (led, HIGH); //ONdelay(1000); //esperadigitalWrite (led, LOW); //OFFdelay(250); //ESPERA

digitalWrite (led, HIGH); //ONdelay(100); //esperadigitalWrite (led, LOW); //OFFdelay(250); //ESPERA

digitalWrite (led, HIGH); //ONdelay(10); //esperadigitalWrite (led, LOW); //OFFdelay(250); //ESPERA

}

Page 23: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIONEl arduino trabaja de forma correcta con el encendió del led.

Instrumentación virtual

Page 24: Manual de Arduino Intrumentación Virtual.docx

Practica N° 8Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEl objetivo de esta práctica es que tengamos diferentes salidas tales como la 13 y 12 y se realice 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;

Page 25: Manual de Arduino Intrumentación Virtual.docx

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

}

Page 26: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIONEl parpadeo del led fue el establecido y las entradas y salidar son la 13 y12.

Page 27: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 9Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEl objetivo de esta práctica es hacer una secuencia de encendido donde se utilizan 5 led y su función es un encendido de 1000 milisegundos y un apagado de 1000 milisegundos

CODIGO ARDUINO

/*

Page 28: Manual de Arduino Intrumentación Virtual.docx

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

Page 29: Manual de Arduino Intrumentación Virtual.docx

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);

}

Page 30: Manual de Arduino Intrumentación Virtual.docx

CONCLUSION

La secuencia de leds prendió de la manera ordenada que se le notifico por lo que la práctica queda completa.

Page 31: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 10Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEl objetivo es hacer una secuencia de encendido donde se utilizan 5 led y su función 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.

Page 32: Manual de Arduino Intrumentación Virtual.docx

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

Page 33: Manual de Arduino Intrumentación Virtual.docx

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);

}

Page 34: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIONLa cadena de leds prende de forma ordenada secuencialmente.

Page 35: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 11Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEn esta práctica y es una secuencia de encendido donde se utilizan 3 led´s y su función 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

Page 36: Manual de Arduino Intrumentación Virtual.docx

/*

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

Page 37: Manual de Arduino Intrumentación Virtual.docx

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);

}

CONCLUSIONEl arduino trabaja de forma correcta con el encendió de uno sí y otro no. F

Page 38: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 12Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEn esta práctica es una secuencia de encendido donde se utilizan 5 led y su función 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

/*

Page 39: Manual de Arduino Intrumentación Virtual.docx

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 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(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)

Page 40: Manual de Arduino Intrumentación Virtual.docx

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);

}

CONCLUSIONEl arduino trabaja de forma correcta con el encendió de uno sí y otro no.

Page 41: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 13Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEsta práctica consiste en incluir de la practica 9 a la 11.

CODIGO ARDUINO

const int led1 = 13;

const int led2 = 12;

const int led3 = 8;

Page 42: Manual de Arduino Intrumentación Virtual.docx

const int led4 = 7;

const int led5 = 4;

// La rutina de instalación 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 tensión)

delay(1000); // esperar un segundo

digitalWrite(led1, LOW); // apagar el LED por lo que la tensión 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)

Page 43: Manual de Arduino Intrumentación Virtual.docx

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

Page 44: Manual de Arduino Intrumentación Virtual.docx

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);

Page 45: Manual de Arduino Intrumentación Virtual.docx

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);

Page 46: Manual de Arduino Intrumentación Virtual.docx

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);

}

CONCLUSIONEn programa funciona bien con los tiempos del delay y la cadena. Utilizando 5 led´s.

Page 47: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 14Ortega Morales Sabino de Jesús

Page 48: Manual de Arduino Intrumentación Virtual.docx

Grupo:7M1

OBJETIVO El programa hace, y es una secuencia de encendido donde se utilizan 5 led y su funcionamiento es juntar las prácticas 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() {

Page 49: Manual de Arduino Intrumentación Virtual.docx

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);

Page 50: Manual de Arduino Intrumentación Virtual.docx

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);

Page 51: Manual de Arduino Intrumentación Virtual.docx

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)

Page 52: Manual de Arduino Intrumentación Virtual.docx

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);

}

CONCLUSION

Page 53: Manual de Arduino Intrumentación Virtual.docx

En los pines 13, 12, 8, 7, 4 se cargan las secuencias que se van a realizar con 5 led, manteniendo el delay (más rápido o entre más tenga es más lento el anterior fue de 1000 en encendido y apagado 1000)

Instrumentación virtual

Practica N° 15Ortega Morales Sabino de Jesús

Page 54: Manual de Arduino Intrumentación Virtual.docx

Grupo:7M1

OBJETIVOEl objetivo de esta práctica 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);

Page 55: Manual de Arduino Intrumentación Virtual.docx

}

// 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);

Page 56: Manual de Arduino Intrumentación Virtual.docx

}

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++)

{

Page 57: Manual de Arduino Intrumentación Virtual.docx

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

Page 58: Manual de Arduino Intrumentación Virtual.docx

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.

Page 59: Manual de Arduino Intrumentación Virtual.docx

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);

}

}

Page 60: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIONEn secuencial de leds prende de la forma en q se programó el código.

Page 61: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 16Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOSe realiza un rayo de luz, o más poéticamente, una estrella fugaz, moviéndose a través de una línea de LED-s. Podremos configurar tanto la velocidad de la estrella, así como la longitud de la cola utilizando los delays

Page 62: Manual de Arduino Intrumentación Virtual.docx

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

// Número de LED-s que permanecen encendidos antes de empezar a apagarlos para

//formar la cola

int tailLength = 4;

// Número de LED-s conectados (que es también el tamaño del array)

int lineSize = 11;

void setup() // Configuración 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

Page 63: Manual de Arduino Intrumentación Virtual.docx

// 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 función 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);

}

}

Page 64: Manual de Arduino Intrumentación Virtual.docx

COCLUSIONSe puede observar el funcionamiento del programa imitando una estrella fugaz, es decir el tiempo en que los led prenden es muy rápido.

Page 65: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 17Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVO Se realiza la practica 10 solo que esta vez se le añadirán más leds y los tiempos de delay cambiaran para que aun siga pareciendo una estrella fugaz.

Page 66: Manual de Arduino Intrumentación Virtual.docx

CODIGO ARDUINO

int controlLed = 13; // LED de control

int waitNextLed = 100; // Tiempo antes de encender el siguiente LED

// Número de LED-s que permanecen encendidos antes de empezar a apagarlos para

//formar la cola

int tailLength = 4;

// Número de LED-s conectados (que es también el tamaño del array)

int lineSize = 11;

void setup() // Configuración 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

Page 67: Manual de Arduino Intrumentación Virtual.docx

delay(waitNextLed);

if (tailCounter == 0)

{

// Se apagan los LED-s en función 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);

}

}

Page 68: Manual de Arduino Intrumentación Virtual.docx

CONCLUSIÓNEl código hace que en forma física a los leds imiten una serie muy parecida a una estrella fugaz.

Page 69: Manual de Arduino Intrumentación Virtual.docx

Instrumentación virtual

Practica N° 18Ortega Morales Sabino de Jesús

Grupo:7M1

OBJETIVOEsta práctica se adjunta las prácticas 13 y 17(que es un conjunto de todas las prácticas).

CODIGO ARDUINO

Page 70: Manual de Arduino Intrumentación Virtual.docx

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

// Número de LED-s que permanecen encendidos antes de empezar a apagarlos para

//formar la cola

int tailLength = 3;

// Número de LED-s conectados (que es también el tamaño 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 ()

Page 71: Manual de Arduino Intrumentación Virtual.docx

{

//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

Page 72: Manual de Arduino Intrumentación Virtual.docx

//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

Page 73: Manual de Arduino Intrumentación Virtual.docx

//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

Page 74: Manual de Arduino Intrumentación Virtual.docx

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 función de la longitud de la cola.

digitalWrite(pinArray[i-tailLength],LOW);

}

else

Page 75: Manual de Arduino Intrumentación Virtual.docx

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);

}

}

COCLUSION

Page 76: Manual de Arduino Intrumentación Virtual.docx

Se puede observar el funcionamiento del programa imitando una estrella fugaz, es decir el tiempo en que los led prenden es muy rápido, y también las animaciones así como la unión de las practicas 9,10,11,12,13 (antes ya explicadas).