Rivamar_Práctico_01

March 24, 2018 | Author: rivamara5960 | Category: Arduino, Light Emitting Diode, Electrical Engineering, Technology, Digital Technology


Comments



Description

- UTN FRSF - OTRA FORMA DE APRENDER - DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO - PRACTICO I - ELECTRONICA - PROGRAMACION - SIMULACION- a. Utilizando 123D Circuits (o el IDE de Arduino + Fritzing), implementar los siguientes circuitos. Importante: los 3 ejercicios se deberán respetar los pines que se muestran en las imágenes. Entregar en un archivo comprimido (.rar) con sus respectivos códigos y una imagen o captura de pantalla del circuito. a. Parpadeo de un led con periodos de 800mS encendido y 400mS apagado. Elementos a utilizar:  1 LED  1 Resistencia (220 Ω)  1 Placa Arduino (pin 2) 1 PRACTICO I .UTN FRSF .ELECTRONICA .OTRA FORMA DE APRENDER .SIMULACION - Esquema con Fritzing: Código con IDE Arduino: 2 .DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO .PROGRAMACION .. y los valores intermedios activarán secuencialmente los demás leds. Elementos a utilizar:  5 LED  5 Resistencias (220 Ω)  1 Potenciómetro  1 Placa Arduino (pines 2-6 y A0) 3 .ELECTRONICA .UTN FRSF .PROGRAMACION . para esto se necesitará utilizar la función map(). cuando la lectura sea 5v estarán todos prendidos.PRACTICO I . Aclaración: cuando la lectura en el potenciómetro sea 0v estarán todos los leds apagados. Se deberá obtener una lectura (analógica) desde un potenciómetro el cual nos activará de 1 a 5 leds.OTRA FORMA DE APRENDER .DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO .SIMULACION - b.. 3. // pin de conexión del potenciómetro const int ledCount = 5..PROGRAMACION . Alfredo. 0.DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO . LOW). thisLed < ledCount.PRACTICO I . ledCount). } } void loop() { //lectura del potenciómetro: int sensorReading = analogRead(analogPin). 6}. } } } 4 . OUTPUT). // por 5 LED conectados int ledPins[] = {2.ELECTRONICA . HIGH). encender este pin: if (thisLed < ledLevel) { digitalWrite(ledPins[thisLed]. 5. 1023. 0. Práctico 1b Arduino UTN FRSF */ // Definición de constantes: const int analogPin = A0. thisLed++) { //si el índice de elementos del array es menor que ledLevel. thisLed < ledCount. } //apagar todos los pines más altos que ledLevel: else { digitalWrite(ledPins[thisLed]. // array conteniendo números de pines de conexión de los LED void setup() { //lazo con el número de pin y envío a la salida del array: for (int thisLed = 0.SIMULACION - Código IDE Arduino: /*Rivamar. // lazo sobre el array de LED: for (int thisLed = 0.UTN FRSF . //convertir el resultado a un rango entre 0 y el número de LED (5): int ledLevel = map(sensorReading. thisLed++) { pinMode(ledPins[thisLed].OTRA FORMA DE APRENDER . 4. PROGRAMACION . Elementos a utilizar:  1 Placa Arduino (pines 8 ST_CP.ELECTRONICA .UTN FRSF .DS y 12 . 5 .DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO . Mostrar secuencialmente (mediante 8 leds) el código binario natural de 8 bits con una secuencia de 500mS. el numero decimal que está contando. Además.OTRA FORMA DE APRENDER . Se deberá utilizar un bucle for() para aumentar el número..SIMULACION - c. siempre escribiendo en línea nueva. 11. indicara en el monitor serial. la función shiftOut() y un registro de desplazamiento.PRACTICO I .SH_CP)  1 74HC595  8 LED  8 resistencias. PRACTICO I . } void loop() { //contar desde 0 a 255 for (int i = 0. Alfredo. //Pin 12 Arduino conectado al Pin 11 del 74HC595 (Clock) int clockPin = 12. Práctico 1c Arduino UTN FRSF */ //Pin 8 Arduino conectado al Pin 12 del 74HC595 (Latch) int latchPin = 8. void setup() { //configurar pines como salidas (output) pinMode(latchPin. //poner latchPin en alto para cerrar el registro y enviar datos digitalWrite(latchPin.SIMULACION - Código IDE Arduino: /*Rivamar. delay(500).OTRA FORMA DE APRENDER .UTN FRSF . LOW). //Pin 11 Arduino conectado al Pin 14 del 74HC595 (Data) int dataPin = 11.DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO . i < 256. pinMode(dataPin. OUTPUT).PROGRAMACION . i++) { //poner latchPin en bajo para permitir el flujo de datos digitalWrite(latchPin. //registro de desplazamiento listo para enviar datos 6 . shiftOut(i). pinMode(clockPin.ELECTRONICA . OUTPUT). } } void shiftOut(byte dataOut) { boolean pinState.. OUTPUT). HIGH). UTN FRSF .. i++) { //set clockPin en LOW previo enviar un bit digitalWrite(clockPin. LOW). //si el valor de DataOut y (AND lógico) en bitmask es verdadero.OTRA FORMA DE APRENDER . } //poner dataPin en HIGH o en LOW dependiendo de pinState digitalWrite(dataPin. } 7 . for (int i=0. pinState). digitalWrite(clockPin. i<=7.ELECTRONICA . LOW).SIMULACION - digitalWrite(dataPin. LOW). HIGH).PRACTICO I . LOW).DESARROLLO DE SISTEMAS DE CONTOL BASADOS EN PLATAFORMA ARDUINO . } else { pinState = LOW. } //detener el desplazamiento de datos digitalWrite(clockPin. digitalWrite(clockPin.PROGRAMACION . poner pinState en 1 (HIGH) if ( dataOut & (1<<i) ) { pinState = HIGH.
Copyright © 2024 DOKUMEN.SITE Inc.