En esta primera prctica 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 ms que la de prender un LED y con la ayuda de los delays modular la velocidad con la que enciende un LED.
PRACTICA N1
CONCLUSION Gracias a la funcin del cdigo, ms especficamente del delay el LED prende y a paga a 100mili segundos.
OBJETIVO Esta prctica es muy precisa a la uno lo nico que la diferencia son los valores del delay , recordemos que un delay equivale a milsimas de segundos.
COCLUSION El objetivo de la prctica fue cumplido ya que el led prenda y apagaba cada 10 milisegundos que fue el valor preestablecido en el cdigo. Se recomienda jugar con los valores para su mejor entendimiento en el cdigo.
OBJETIVO Ya que aprendimos a usar el delay lo modificaremos a nuestro gusto poniendo 1000 para el prendido y 100 para el apagado.
CONCLUSIN El delay no solo sirve para apagar y prender el led lo ms rpido posible sino que tambin nos sirve para intercambiarlos, es decir puedo prender ms rpido y que se apague ms lento.
OBJETIVO En esta prctica 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).
El led se puede conectar directo o con el uso del protoboard
CONCLUSIN La prctica se concluy de forma satisfactoria comprobando el funcionamiento de delay.
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
/* aqui se apaga */
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(10000); // wait for a second
El led prende directamente conectado en el Arduino en el pin 13 y el grand
CONCLUSION En la prctica de forma fsica pude observar que el led enciende 10 veces y despus apaga, logrando la efectividad del programa en arduino. Esto quiere decir que el tiempo que le asignamos en el programa se cumpli.
OBJETIVO Se pedir en esta prctica que el programa de 20 pulsos en led y se queda encendido, tambin que cuando encienda parpadea 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
}
CONCLUSION El parpadeo de los leds se llev 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 }
CONCLUSION El arduino trabaja de forma correcta con el encendi del led.
OBJETIVO El objetivo de esta prctica 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; 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.
OBJETIVO El objetivo de esta prctica 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); }
CONCLUSION La secuencia de leds prendi de la manera ordenada que se le notifico por lo que la prctica queda 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); }
CONCLUSION La cadena de leds prende de forma ordenada secuencialmente.
OBJETIVO En esta prctica y es una secuencia de encendido donde se utilizan 3 leds 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); }
CONCLUSION El arduino trabaja de forma correcta con el encendi de uno s y otro no. F
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 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) 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); }
CONCLUSION El arduino trabaja de forma correcta con el encendi de uno s y otro no.
OBJETIVO Esta prctica 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);
}
CONCLUSION En programa funciona bien con los tiempos del delay y la cadena. Utilizando 5 leds.
OBJETIVO El programa hace, y es una secuencia de encendido donde se utilizan 5 led y su funcionamiento es juntar las prcticas 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); }
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 en q se program el cdigo.
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],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); } }
COCLUSION Se puede observar el funcionamiento del programa imitando una estrella fugaz, es decir el tiempo en que los led prenden es muy rpido.
OBJETIVO Se realiza la practica 10 solo que esta vez se le aadirn ms leds y los tiempos de delay cambiaran para que aun siga pareciendo una estrella fugaz.
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 a los leds imiten una serie muy parecida a una estrella fugaz.
OBJETIVO Esta prctica se adjunta las prcticas 13 y 17(que es un conjunto de todas las prcticas). 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
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); } }
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 as como la unin de las practicas 9,10,11,12,13 (antes ya explicadas).