Code: Select all
void setup() {
matrix.begin();
matrix.setBrightness(40);
}
// eight color intensity steps 0-8
byte red = 0;
byte green = 0;
byte blue = 0;
// 16 bit color input to matrix.Color
uint16_t color = 0;
void loop() {
for (uint8_t i=0; i<8; i++){
matrix.fillScreen(0);
// step through red
red = 9 * pow(i,0.65);
green = 0;
blue = 0;
color = matrix.Color(red, green, blue);
matrix.fillRect(4, 0, 1, 8, color);
// step through yellow
red = 9 * pow(i,0.65);
green = i * 9;
blue = 0;
color = matrix.Color(red, green, blue);
matrix.fillRect(3, 0, 1, 8, color);
// step through green
red = 0;
green = i * 9;
blue = 0;
color = matrix.Color(red, green, blue);
matrix.fillRect(2, 0, 1, 8, color);
// step through blue
red = 0;
green = 0;
blue = 52 * pow(i,0.803);
color = matrix.Color(red, green, blue);
matrix.fillRect(1, 0, 1, 8, color);
// step through violet
red = 9 * pow(i,0.65);
green = 0;
blue = 52 * pow(i,0.803);
color = matrix.Color(red, green, blue);
matrix.fillRect(0, 0, 1, 8, color);
matrix.show();
delay(2000);
}
delay(2000);
}