sábado, 9 de julio de 2016

MEGA CIRCUITO EN PAREJA

REALIZADO: 28-JUN-2016

Llego el momento de hacer un MEGA CIRCUITO, asi que si apenas pudimos hacer lo anterior tratando de comprender, la practica que viene iba hacer terrible!

Lo que buscamos es juntar la progrmacion arduino y los circuitos realizados anteriormente y crear una secuencia diversa en cada fila. Este trabajo seria en grupo, y mi companera es Karla Aviles. Juntamos materiales para realizar el trabajo:

  •  12 LEDS (6 para cada fila)
  • Botonera 4 pin
  • Jumpers macho macho
  • Arduino UNO
  • Protoboard
  • Resistencias 220 Ω
  • Potenciometro 1k
PROGRMACION 

int boton;
int vel;
int cuenta = 0;
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, INPUT);
  Serial.begin(9600);
  Serial.print("Estado");
  Serial.print(" - ");
  Serial.println("Velocidad");
  }

// the loop function runs over and over again forever
void loop() {
boton = digitalRead(10);
vel = analogRead(0);
if(boton == HIGH){
  digitalWrite(2, HIGH);
  delay(vel);          
  digitalWrite(3, HIGH);
  delay(vel);
    digitalWrite(2, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(4, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);// wait for a second
    digitalWrite(3, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(5, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(4, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(6, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(5, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(7, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(6, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(8, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(7, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(9, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(9, LOW);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(7, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(6, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(7, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(5, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(6, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(4, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(5, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(3, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
      digitalWrite(4, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(2, HIGH);    // turn the LED off by making the voltage LOW
  delay(vel);
    digitalWrite(3, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(vel);              // wait for a second
  digitalWrite(2, LOW);
  cuenta = cuenta + 1;
  Serial.print(1);
Serial.print("      -     ");
  Serial.println(vel);
  }
else{
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(vel);
digitalWrite(4, HIGH);
digitalWrite(7, HIGH);
delay(vel);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(vel);
digitalWrite(3, HIGH);
digitalWrite(8, HIGH);
delay(vel);
digitalWrite(4, LOW);
digitalWrite(7, LOW);
delay(vel);
digitalWrite(2, HIGH);
digitalWrite(9, HIGH);
delay(vel);
digitalWrite(3, LOW);
digitalWrite(8, LOW);
delay(vel);
digitalWrite(2, LOW);
digitalWrite(9, LOW);
delay(vel);
digitalWrite(3, HIGH);
digitalWrite(8, HIGH);
delay(vel);
digitalWrite(4, HIGH);
digitalWrite(7, HIGH);
delay(vel);
digitalWrite(3, LOW);
digitalWrite(8, LOW);
delay(vel);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(vel);
digitalWrite(4, LOW);
digitalWrite(7, LOW);
delay(vel);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
cuenta = cuenta + 1;
Serial.print(0);
Serial.print("      -     ");
Serial.println(vel);
}
if(cuenta == 15){
    Serial.print("Estado");
  Serial.print(" - ");
  Serial.println("Velocidad");
  cuenta = 0;
}
}




Circuito Potenciometro
El trabajo fue dificultoso ya que, el portoboard se cayo y algunos clabes se danaron, nos toco reconstruir todo y al hacerlo se nos quemaron dos LED's; pero al final logramos entender nuestros errores con ayuda de nuestros companeros.

PSDT: no hubiesemos hecho nada sin la ayuda de ERICK PULLA! Mil gracias, de Karla y Patty.


No hay comentarios:

Publicar un comentario