×

Gene Code's video: Arduino Uno: Multicolor LED Pulsation Code in Description

@Arduino Uno: Multicolor LED Pulsation (Code in Description)
A simple circuit and sketch to make pulsating multicolor LED. Just got myself an arduino last week. And today I tried to do something new. When I worked in JVC a while ago, the dvd player had a cool lighting feature dubbed "Lip-Lap". it is basically a pulsating multicolor LED. So tried to reproduce the effects here. I put a white paper on top of the led to diffuse the light and it looks pretty cool! For the sketch, I make use of the sine function. Since sine wave "pulsates" too! Or you could use cos function for the other LED pins. Try to play around with the numbers in the sketch. Sketch: int ledPin11 = 11; int ledPin10 = 10; int ledPin9 = 9; float countB = 0; float countR = 0; float countG = 0; void setup() { // put your setup code here, to run once: pinMode(ledPin9, OUTPUT); pinMode(ledPin10, OUTPUT); pinMode(ledPin11, OUTPUT); } void loop() { // put your main code here, to run repeatedly: // digitalWrite(ledPin, HIGH); // analogwrite on this function works on pins 3, 5, 6, 9, 10, and 11. countB=countB+0.1; countR=countR+0.03; countG=countG+0.06; // =(1+sin(B4))*127 int valB = 127*(1+sin(countB)); analogWrite(ledPin11,valB); int valR = 127*(1+sin(countR)); analogWrite(ledPin10,valR); int valG = 127*(1+sin(countG)); analogWrite(ledPin9,valG); delay(20); }

2

1
Gene Code
Subscribers
841
Total Post
47
Total Views
254.7K
Avg. Views
5.1K
View Profile
This video was published on 2018-03-18 15:28:23 GMT by @Gene-Code on Youtube. Gene Code has total 841 subscribers on Youtube and has a total of 47 video.This video has received 2 Likes which are lower than the average likes that Gene Code gets . @Gene-Code receives an average views of 5.1K per video on Youtube.This video has received 1 comments which are lower than the average comments that Gene Code gets . Overall the views for this video was lower than the average for the profile.

Other post by @Gene Code