Evaluación 1: Arduino Outputs (Sofía Díaz, Leticia Brandao, Melanie Collins, Camila González)
| Título | Evaluación 1: Arduino Outputs |
|---|---|
| Asignatura | Interacción y Performatividad |
| Del Curso | Interacción y Performatividad 2019 |
| Carreras | Diseño |
| Nº | 1 |
| Alumno(s) | Sofía Díaz, Camila González Ossa, Melanie Collins, Letícia Brandão |
| URL | https://www.youtube.com/watch?v=y-jbn18MKoI&feature=youtu.be |
Evaluación 1: Arduino Outputs


Encienda 5 leds con un patrón a definir por el alumno.
Código Arduino:
nt led3 = 8 ; // the PWM pin the LED is attached to
int led4 = 7 ; // the PWM pin the LED is attached to
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led4, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
digitalWrite(led4, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(100);
}
}
Encienda 3 leds con efecto "degradé" o "fade"
Código Arduino:
int led1 = 5; // the PWM pin the LED is attached to
int led2 = 3 ; // the PWM pin the LED is attached to
int brightness1 =100; // how bright the LED is
int brightness2 = 0; // how bright the LED is
int fadeAmount1 = 5; // how many points to fade the LED by
int fadeAmount2 = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led1, brightness1);
analogWrite(led2, brightness2);
// change the brightness for next time through the loop:
brightness1 = brightness1 + fadeAmount1;
brightness2 = brightness2 + fadeAmount2;
// reverse the direction of the fading at the ends of the fade:
if (brightness1 <= 10 || brightness1 >= 255) {
fadeAmount1 = -fadeAmount1;
if (brightness2 <= 0 || brightness2 >= 100)
fadeAmount2 = -fadeAmount2;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
Encienda 1 led RGB con el que debe pasar por los 3 colores principales.
Código Arduino:
int redPin = 9;
int greenPin = 10;
int bluePin = 13;
int i;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop()
{
digitalWrite(redPin,LOW);
delay(500);
digitalWrite(redPin,HIGH);
delay(500);
digitalWrite(greenPin,LOW);
delay(500);
digitalWrite(greenPin,HIGH);
delay(500);
digitalWrite(bluePin,LOW);
delay(500);
digitalWrite(bluePin,HIGH);
delay(500);
digitalWrite(redPin,LOW);
delay(500);
digitalWrite(greenPin,HIGH);
delay(500);
digitalWrite(greenPin,LOW);
delay(500);
digitalWrite(bluePin,HIGH);
delay(500);
digitalWrite(bluePin,LOW);
delay(500);
digitalWrite(redPin,HIGH);
delay(500);
digitalWrite(redPin,LOW);
delay(500);
digitalWrite(redPin,HIGH);
delay(500);
digitalWrite(greenPin,LOW);
delay(500);
digitalWrite(greenPin,HIGH);
delay(500);
digitalWrite(bluePin,LOW);
delay(500);
digitalWrite(bluePin,HIGH);
delay(500);
for(i=255;i>0;i++)
{
digitalWrite(bluePin,LOW);
digitalWrite(greenPin,HIGH);
analogWrite(greenPin,255-i);
analogWrite(redPin,i);
delay(10);
}
}