Hi,
Read though madworms awesome thread and got my matrix working straight away. Now I'm trying the modify the code...
Original Code
void fader_hue(void) {
int ctr1;
byte row;
byte led;
for(ctr1 = 0; ctr1 < 360; ctr1=ctr1+3) {
set_matrix_hue((float)(ctr1));
delay(__fade_delay);
}
}
What I'm trying to do is have the code only run the fader_hue void, which I've done, and be able to control the speed of the fading with a pot connected to analog0. I can get it almost working by changing the for statement to read this:
void fader_hue(void) {
int ctr1;
byte row;
byte led;
Micval = analogRead(Micpin);
Micval = map(Micval, 0, 1023, 1, 100);
Micval = constrain(Micval, 1, 100);
for(ctr1 = 0; ctr1 < 360; ctr1=ctr1+Micval) {
set_matrix_hue((float)(ctr1));
}
}
The problem is that it runs through the whole fade animation and then updates the speed. This means that if Micval is 1 then it runs through the whole fade procedure (3-4 seconds) then updates the speed if Micval has changed. As Micval gets quicker is fades quicker and updates the fade speed quicker. What I want is for it to update the fade speed immediately after a new Micval is present.
Any Ideas?
Cheers