Pages: 1 [2]   Go Down
Author Topic: Can anyone Help me out with Code for a RGB LED Throbbing/Breathing effect  (Read 2169 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well if your looking for RGB LEDs in a strip the 5050 SMD led strips are really cool, can get 5mtr waterproof one for about $40, they can be cut every 9cm , thats what im using , also using some simpler strips without controllers with the arduino instead.



Ya those extra delays look cool, smiley
« Last Edit: June 19, 2011, 08:07:08 pm by DeViL303 » Logged

Fresno, CA, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 153
Arduino rocks (literally, with a WaveShield!)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh my GOD, those LEDs look flippin' incredible!! I watched "Animusic" a while back and watched a sequence where some big electronic "brain" was sending out "pulses" and "streams" of light through tubes or wires to different instruments to make a tune (when the stream/pulse hit it, it made a sound, but you watched the pulse/stream move along the tube to it). These would be AMAZING for creating a similar effect without CG... I mean, the possibilities there are just "wow".

Yep, you're definitely on the track to making some cool stuff with that. smiley-grin
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cheers, ya the 5050 strips are the buisness. I must check out that Animusic, sounds interesting. The effect i have now with your code i actually more than i had hoped for as it cycles through the colours on each breath, not just limited to one colour per breath.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also There is another part to this RGB LED system that I would like to combine into same code so it can all be run from one arduino if possible:

The other system is basically a RGB strip with 3 linear potentiometers controlling PWM, one controlling each colour. Now I have found some code that does what I want but Im not sure how to combine 2 different programs without the delays/loops in one program interfering with the other program. I suppose it would mean coding without delays, It might be easier to just buy 2 arduinos as they are relatively cheap. Here is the code i found:
Code:
1.
2.// Init the Pins used for PWM
3.const int redPin = 9;
4.const int greenPin = 10;
5.const int bluePin = 11;
6.
7.// Init the Pins used for 10K pots
8.const int redPotPin = 0;
9.const int greenPotPin = 1;
10.const int bluePotPin = 2;
11.
12.// Init our Vars
13.int currentColorValueRed;
14.int currentColorValueGreen;
15.int currentColorValueBlue;
16.
17.void setup()
18.{
19.  pinMode(redPin, OUTPUT);
20.  pinMode(greenPin, OUTPUT);
21.  pinMode(bluePin, OUTPUT);
22.}
23.
24.void loop()
25.{
26.// Read the voltage on each analog pin then scale down to 0-255 and inverting the value for common anode
27.  currentColorValueRed = (255 - (analogRead(redPotPin) / 4));
28.  currentColorValueBlue = (255 - (analogRead(bluePotPin) / 4));
29.  currentColorValueGreen = (255 - (analogRead(greenPotPin) / 4));
30.
31.// Write the color to each pin using PWM and the value gathered above
32.  analogWrite(redPin, currentColorValueRed);
33.  analogWrite(bluePin, currentColorValueBlue);
34.  analogWrite(greenPin, currentColorValueGreen);
35.
36.}
37.


BTW : If anyone else has any ideas for coding the RGB throb/breathing effect I would be interested in hearing them, as im learning all the while. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

While FalconFours code for the breathing effect is cool its not quite what my friend wanted for his kaleidoscopes as it cycles through the colours during each "breath", hes was looking specifically for one colour per "breath",

So for example
red fades in , then fades out but as it gets to 10% then the blue and red start fading in together (purple),then they fade out together but as they get to 10% then the blue starts ramping up on its own, then it fades out and as it gets to 10% the green starts to fade in ...etc. . even just 3 or 5 colours would do.

Hardcoded 7 colour with an changeable delay would be cool, Im just not sure where to start as I havnt the skill to start a program from scratch. Obviously if i could have each seperate "breath" move slowly along the LED strip that would be a really amazing effect but that would require shift registers or god knows what so im just trying to get a simpler version running for now!
  
« Last Edit: June 20, 2011, 10:51:29 am by DeViL303 » Logged

Pages: 1 [2]   Go Up
Jump to: