top of page

Press play - LED

Updated: Apr 28, 2021


This Blog will record the first time I lit up the LED light and designed the Behavior for a Set of LEDs by myself.


Before going to the workshop, I have watched an example video of how to light a bulb (n.d.), including the detailed step-by-step explanation below. But when I went to the workshop, the actual operation was still a little different.


I connected my circuit board according to the diagrams and tips on the teacher's whiteboard and the example.


But I reversed one of the positive and negative electrodes in my first attempt, which caused me to be unable to light up smoothly anyway.


Finally, I lit it up by using the LED testing code.


Then I started thinking about the lighting behaviour that I wanted to design. At first, I tried it at random, but I thought it was bland and ordinary and could have been better.


At this time, I heard the background music of the classroom, which is a precise rhythm, the speed of the change of the apparent song. So I decided to design the lighting behaviour of the bulb with obvious differences in rate according to the inspiration of the music rhythm. I created three flicker frequencies, 40, 200 and 1000.


Each frequency is five times faster than the previous frequency, creating a solid rhythmic contrast. Then, I set it up to have a long pause in the middle, and this is when I was writing this code, and the interludes of the song are much lower than the rest of the time.


It is a copy of the new function I have written:

void setup() {//initialize digital pin 5,6 and 7 as an output.
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);

}

void loop() {
digitalWrite(5, HIGH); // turn the green LED on(HIGH is the voltage level)
delay(40); // wait for a second
digitalWrite(5, LOW); // turn the green LED offby making the voltage LOW
delay(40); // wait for a second
digitalWrite(6, HIGH); // turn the blue LEDon (HIGH is the voltage level)
delay(40); // wait for a second
digitalWrite(6, LOW); // turn the blue LED offby making the voltage LOW
delay(40); // wait for a second
digitalWrite(7, HIGH); // turn the red LED on(HIGH is the voltage level)
delay(40); // wait for a second
digitalWrite(7, LOW); // turn the red LED off bymaking the voltage LOW
delay(40); // wait for a second
digitalWrite(5, HIGH); // turn the green LED on(HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(5, LOW); // turn the green LED offby making the voltage LOW
delay(200); // wait for a second
digitalWrite(6, HIGH); // turn the blue LEDon (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(6, LOW); // turn the blue LED offby making the voltage LOW
delay(200); // wait for a second
digitalWrite(7, HIGH); // turn the red LED on(HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(7, LOW); // turn the red LED off bymaking the voltage LOW
delay(40); // wait for a second
delay(400); // wait for a second
digitalWrite(5, LOW); // turn the green LED offby making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the blue LEDon (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the blue LED offby making the voltage LOW
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the red LED on(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, LOW); // turn the red LED off bymaking the voltage LOW
delay(1000); // wait for a second
}


References:


Arduino. 2018. Fade. Available at: <https://www.arduino.cc/en/Tutorial/BuiltInExamples/Fade>.


n.d. [Video] Available at: <https://www.instructables.com/Carnival-Lights-Game/>.



Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2021 by Fei's Design. Proudly created with Wix.com

bottom of page