Analog control of 15 outputs - Beginner question

As Grumpy_Mike you would certainly need some additional hardware to handle all of those outputs.That's a separate task to deal with. :roll_eyes:

Setting up the digital input won't be a problem. Here is an example of setting up a digital input using a button and a 10K resistor:
http://arduino.cc/en/tutorial/button :slight_smile:

Or if you don't have a 10K resistor you could use the internal pull-up resistor right on the Arduino which would save up some wiring. Here is a video tutorial:

Also be aware that Arduino Mini has only 6 PWM outputs and you need 15 of them which means you would need some extension for that too. That's something hard for me to explain since I have no good knowledge in that. :cold_sweat:

I could guide you through the "system for simple syntax of this control" as I like it how you call it, very formal. :wink:

First of all, you could create your own function. Here is a link to it if you won't understand my explanation:

So you want: (LED#, color, brightness). Lets create a function and call it "rgbControl" and let it control some of the attributes.
Note: I will separate the color section into three sections, R, G and B. I will remove the LED number in you proposal but you can add it any time

void  rgbControl(int r, int g, int b, float brightness){
  // let's say the RGB led has its RGB pins on number 1,2 and 3
  // Input the brightness in percentages
  analogWrite(1,(r*brightness/100)); // lets set its red value
  analogWrite(2,(g*brightness/100)); // lets set its green value
  analogWrite(3,(b*brightness/100)); // lets set its  blue value
}

Put this code before or after the loop() function (not in the function). And in the loop() itself you could write something like

This will give you a red at a 50% brightness:

rgbControl(256,0,0,50);

This will give you a green at a 80% brightness:

rgbControl(0,256,0,80);

This will give you a red at a 100% brightness:

rgbControl(0,0,256,100);

The final sketch may look something like:

void setup () {
}

void loop () {
  rgbControl(256,0,0,50); //This will give you a red at a 50% brightness:
  rgbControl(0,0,0,0);    //Set values to off
  rgbControl(0,256,0,80); //This will give you a green at a 80% brightness:
  rgbControl(0,0,0,0);    //Set values to off
  rgbControl(0,0,256,100); //This will give you a red at a 100% brightness:
  rgbControl(0,0,0,0);     //Set values to off
}
void  rgbControl(int r, int g, int b, float brightness){
  // let's say the RGB led has its RGB pins on number 1,2 and 3
  // Input the brightness in percentages
  analogWrite(1,(r*brightness/100)); // lets set its red value
  analogWrite(2,(g*brightness/100)); // lets set its green value
  analogWrite(3,(b*brightness/100)); // lets set its  blue value
}

I hope this will get you started. If you have questions just ask :slight_smile: