Hi. First of, I´m a total n00b at both Arduino and general programming.
I while ago a friend helped me out with a simple code for fading 6 LEDs in a sort of organic pulse.
Now I have a similar project, but my friend´s not here anymore and I have to ask around elsewhere.
For my new project I want the same organic fading flow, but with more diodes, maybe up to 24.
Is this possible with the UNO somehow? Help in a language I´ll manage is MUCH appreciated
This is the original 6-LED code:
/* 6LEDorganic*/
int i; // counter variable
float LED[] = {1,1,1,1,1,1}; // pwm brightness variables
float spChg[] = {1.006, 1.004, 1.008, 1.007, 1.005, 1.009}; // speed varialbes to fade LED's - change these for faster or slower fades
// values should be close to and greater than 1
int pwmPins[] = {3,5,6,9,10,11}; // PWM pins - 3,5,6 won't work on Atmega8
int ud[]={1,1,1,1,1,1}; // up - down multiplier
void setup() {
Serial.begin(9600);
}
void loop() {
for (i=0; i<=5; i++){
if (LED > 255){
_ ud = -3;_
* }*
_ else if(LED < 38){
ud = 1;
}_
_ if (ud == 1){ // up flag, multiply spChg variable
LED = LED * spChg*; // multiply by a fixed amount - spCh array controls the speed of fade*
* }
else*
* { // down flay, divide spChg variable*
LED = LED / spChg*;*
* }*_
analogWrite(pwmPins_, (int)LED*);
delay(1); // this will interact with the spChg variables to control ultimate fade speed*
}
}_