Pages: [1]   Go Down
Author Topic: Timer1 help  (Read 543 times)
0 Members and 1 Guest are viewing this topic.
Vancouver, Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 118
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I need a way to start and stop the timer1 attach function in my loop.
The function:
Code:
Timer1.attachInterrupt(myFunction, Period)
is declared in the setup routine. I have the period to 1000 micro seconds, because I need this myFunction to run every ms. However I need a way to enable and disable this functionality of timer1 in my loop routine.

Any ideas? or a better way?

Thanks
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 630
Posts: 49998
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Any ideas?
Well, that would depend on what Timer1 is an instance of. We don't do snippets here.
Logged

Vancouver, Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 118
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is timer1:
http://www.arduino.cc/playground/code/timer1

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 630
Posts: 49998
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That page lists methods like start() and stop(). They appear, to me, to be what you need to start and stop your timer. Obviously, stopped timers stop firing their events.
Logged

Pages: [1]   Go Up
Jump to: