Dear All,
I'm new on Mapple! As usual because the lack of power from Arduino. :D
I'm really interested in the 4 channels Timers for my final application, but in my initial tests with small pieces of code for familiarization, I got stuck in the Timers Functions.
I already manage to have the Timers working, but now I don't know what's wrong with the following code because even with TIMER_CH1 set to 1/5 of the overflow value (1 and 5sec), the BOARD_LED flash at 5 sec. rate (Overflow value)...
Can you please let mw know what's wrong?!
IDE v0.0.12
void Interrupt_Fo_Step(void);
HardwareTimer Timer_Fo(1); //Set Timer_Fo to Timer1
int temp=0;
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT);
Timer_Fo.setMode(TIMER_CH1, TIMER_OUTPUT_COMPARE); //
Timer_Fo.pause();
Timer_Fo.setCount(0);
Timer_Fo.setPrescaleFactor(7200); //Prescale 7200 -> 0.01Mhz -> 100us
Timer_Fo.setOverflow(50000); //50000*100us = 5sec
Timer_Fo.setCompare(TIMER_CH1, 10000); //10000*100us = 1sec
Timer_Fo.attachInterrupt(TIMER_CH1, Interrupt_Fo_Step);
Timer_Fo.refresh();
Timer_Fo.resume();
}
void loop() {
temp++;
}
void Interrupt_Fo_Step(void) {
toggleLED();
}