Tarea 3 LED RGB - Catalina González, Daniela Cabezas
De Casiopea
Título | Tarea 3 LED RGB - Catalina González, Daniela Cabezas |
---|---|
Asignatura | Interacción y Performatividad |
Del Curso | Interacción y Performatividad 2022 |
Carreras | Diseño, Interacción y Servicios"Interacción y Servicios" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property. |
Nº | 3 |
Alumno(s) | Catalina González, Daniela Cabezas |
Registro
Dentro de la tarea 3, se realizo un circuito de LED RGB accionada por un botón, para ello se necesitan los siguiente materiales:
- Botón
- LED RGB
- 4 Resistencias de 1k
- Arduino
- Protoboard
- 10 cables
Paso 1: Configuración de Arduino TINKERCAD
Paso 2: Código
int boton = 2; int estado = 0;
void setup() {
pinMode(11, OUTPUT); //LED rojo pinMode(10, OUTPUT); //LED verde pinMode(6, OUTPUT); //LED azul pinMode(boton, INPUT); //Botón de LED
}
void loop() {
estado = digitalRead(boton); if (estado==HIGH){ analogWrite (11,249); //LED rojo analogWrite (10,0); //LED verde analogWrite (6,191); //LED azul delay(100); //Tiempo de espera } else{ analogWrite(11,0); analogWrite(10,0); analogWrite(6,0); }
}