pert:
Use descriptive variable names. You shouldn't need comments to explain what they mean. If the pin is for the red encoder then just say so in the variable name.
The comments help keep me organized as I am a beginner but I do get what you mean.
larryd:
int fadeAmount = 5; this could be 'byte' if the sketch keeps fadeAmount 0-255unsigned char encoder_A1_prev=0; these could also be 'byte'
Looks like your daughter is going to be a programmer.
Edit
Not sure you saw this:Maybe have a potentiometer the can be adjusted to create a 'divisor'.
It would be used to divide into all three: R, G and B values to set brightness/intensity.
I did see that, I do have a potentiometer, but not three. Thus the use of the encoder.
So basically the simplified version of the setup would look like
unsigned long currentTime;
unsigned long loopTime;
byte fadeAmount = 5; //incremental increase or decrease in LED brightness
byte brightnessRed = 120; //Starting at half the value of full brightness
byte brightnessGreen = 120;//Starting at half the value of full brightness
byte brightnessBlue = 120;//Starting at half the value of full brightness
byte encoder_A1;
byte encoder_B1;
byte encoder_A2;
byte encoder_B2;
byte encoder_A3;
byte encoder_B3;
byte encoder_A1_prev=0;
byte encoder_A2_prev=0;
byte encoder_A3_prev=0;
const byte pin_A1 = 2;//A pin red encoder
const byte pin_B1 = 3;//B pin red encoder
const byte pin_A2 = 4;//A pin green encoder
const byte pin_B2 = 5;//B pin green encoder
const byte pin_A3 = 6;//A pin blue encoder
const byte pin_B3 = 7;//B pin Blue encoder
const byte LED_Red = 11;//Has to be set as output
const byte LED_Green = 10;//Has to be set as output
const byte LED_Blue = 9;//Has to be set as output
void setup()
{
Serial.begin(9600); //Can add Serial.println later to each section
pinMode(LED_Red, OUTPUT);
pinMode(LED_Green, OUTPUT);
pinMode(LED_Blue, OUTPUT);
currentTime = millis();
loopTime = currentTime;
}
}