Workshop_01 ↓ Physical Computing

We started the workshop series on Physical Computing o/ We have covered some parts of the basics — of basics, and brought back home the first exercice: create a flashing pattern with LEDs.

Why not with music? I can literally listen to the song Lov U by Joji for hours: the loop is perfect and it was easy to figure out its beat. OK I may say this afterwards but I have sadly no sense of rythm, so it still wasn’t that easy to coordinate with the LEDs…

Also, I thought it would be interesting to add several LEDs. I noticed each color behaves differently: the white lights longer than the blue for example. Other than that, I have to admit my choice was purely based on aesthetics: blue LEDs definitely look cool.

Well that’s it, you can watch here ↓↓↓

And here the code ↓↓↓

int led1 = 13;
int led2 = 12;
int led3 = 11;

void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}

void loop() {
digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led1, LOW);
delay(1800);

digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led2, LOW);
delay(1800);

digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led3, LOW);
delay(1000);

digitalWrite(led3, HIGH);
delay(50);
digitalWrite(led3, LOW);
delay(800);

digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led2, LOW);
delay(2000);
}

Next thing I should study is maybe how to have the LEDs light up by sound detection?

Leave a Reply

Your email address will not be published. Required fields are marked *

Archives