Lo que veremos en esta práctica sera el como manipular la intensidad de un LED con un algoritmo.
Materiales:
-Protoboard
-ArduinoUno
-cable USB
-LED
-Resistencia 220 ohm
-Cable Dupont
Código:
Int led=9;
Int brillo =0;
Int aumento = 9;
void setup(){
pinMode (Led, OUTPUT);
}
void loop(){
analogWrite(Led, brillo);
brillo= brillo+aumento;
if (brillo ==0 || brillo == 255)
{
aumento = -aumento;
}
delay(30)
}
Foto:
Video:
https://www.youtube.com/watch?v=PpuRonQ7t0A
No hay comentarios:
Publicar un comentario