#define DEBUGLEDPIN 13 #define DEBUGSPEED 15624 #define CHARLIESPEED 24 volatile int brightnessPerLED[4] = { 0x000, 0x000, 0x000, 0x000 }; void setup() { pinMode(DEBUGLEDPIN, OUTPUT); configureInterupt_ArduinoUno(); //configureInterupt_ATtiny85(); } void loop() { recalculateColorBrightnessLED(); delay(200); } //*****************Interrupt code********************************** void configureInterupt_ArduinoUno() { //cli(); noInterrupts(); TCCR1A = 0; //set entire TCCR1A register to 0 TCCR1B = 0; //same //set compare match register to desired timer count: OCR1A = CHARLIESPEED; //int timer1_counter = 34286; //TCNT1 = 34286; //turn on CTC Mode TCCR1B |= (1 << WGM12); //TCCR1B = 1< 5kHz //TIMSK = TIMSK | 1<>2; int rgb = brightnessPerLED[led]; int r = rgb & 0x0F; int b = rgb>>4 & 0x0F; int g = rgb>>8 & 0x0F; int bits = (count < r) | (count < b)<<1 | (count < g)<<2; bits = bits + (bits & 0x07< 15) y = 31 - y; return max(y, 0); } int green (int x) { return red(x + 32); } int blue (int x) { return red(x + 64); }