hi,
i have some code that communicate over i2c with a sensor.
Sometimes the sensor stop working and the code stay locked in the i2c function.
Now i want use an interrupt timer, it has to be launched at least every seconds, and don't modify any prescaler etc.. because i need the timers for external library.
it will look at a variable that is incremented every loop(), and if the variable is >0 all is fine, otherwise it will reset the sensor (turn it off and restart communications?)
i've tried:
void setup(){
Serial.begin(19200);
TIMSK2 |= B00000100;
}
unsigned long time = micros();
void loop(){
}
ISR(TIMER2_OVF_vect) {
Serial.println(micros()-time);
time=micros();
};
but nothing happen... help please?