Question Timer3 use it as a countdown

Status
Not open for further replies.

Bastiaan

Well-known member
Hi guy,

I am currently trying to build a countdownTimer that runs on the background with a teensy3.2
further I am using the Encoder library, debounce Button, and u8g2 library for driving an Oled display.

function of the device

set the Time in hours minutes seconds over a rotary encoder, use the button press to skip through the menu and set each parameter accordingly.
display the variables on a screen and generate a countdown on the screen as well.
this is then repeated by a second countdown for leds to be on.
the PWM on the Output pin should be changeable all time over an analog input.

I have been trying certain options to communicate with various countdowntimers.

the CountdownTimer from Andrew Mascolo, which only works if you place the T.SetTimer(var,var,var); into the void Setup,
and the program freezes if run in the void loop, I just dont understand it. I tried placing it in the back/ before/between my int menu and so on but still no avail.

other libraries, as well as a simple delay example, but I would like to see the timer calculate on the background, and not meddle with the programs that are run in the loop.

so I thought using the Timer3 library so that it exactly runs for a period of time Hours+Minutes+seconds, if arrived at state menu 7.

I can set the hours minutes and seconds(some math accordingly) on the display and paste them in the Timer3.initialize();
run the Timer3.

the Timer3 is generating pulses on my scope and see what it spits out over the Timer3.pwm(25,200); 20us pulses but some pulse shows up after 7 of the first pulses. I have set the analogWriteResolution(12), I dont know if this matters for the Timer3.pwm.


help would be greatful.
 
Status
Not open for further replies.
Back
Top