Go Down

Topic: Timer1 help (Read 694 times) previous topic - next topic

FardinB

Hi,

I need a way to start and stop the timer1 attach function in my loop.
The function:
Code: [Select]
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

PaulS

Quote
Any ideas?

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

FardinB

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


PaulS

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.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy