uint8_t duty = 50; // start @ 50 % duty float freq = 0.44; // start @ 440 hz void set_duty(uint8_t d) { duty = 100- d; update_freq(); } void set_freq(float f) { freq = f; update_freq(); } void update_freq() { uint16_t top = freq/0.440*142/2; OCR2A = (top>0xFF)?0xFF:top; OCR2B = top * duty / 100; } void setup_timer() { // setup timer update_freq(); TCCR2A= (1< class Panel { int maxVals[2]; struct limits { int touchThreas; int minVals[2]; float range[2]; bool caldone; } limits; public: Panel():maxVals{1,1} { // declare pins as input DDRC &= ~((1<