Go Down

Topic: Using tone() or similar function to blink the LED (Read 937 times) previous topic - next topic

Voj?ák

Hello, I have one question: is there any pre-built function that would do the similar thing as [font=Courier New]tone()[/font], but at lower frequencies (let's say 1 to 10 Hz)?
I've tried [font=Courier New]tone()[/font] at low frequencies, but below 16 Hz it makes weird tone at hundreds of Hz.
Or is there any simple way to write that function, which could be called only once and not at each cycle of [font=Courier New]loop()[/font] (similar like [font=Courier New]tone()[/font] works), to produce blinking?
Thanks.

deSilva

#1
Aug 16, 2010, 03:09 am Last Edit: Aug 16, 2010, 03:10 am by mpeuser Reason: 1
Tone uses the 8-bit timer2. The best this one can do is using prescaler 1024 and counting 256.
16 MHz/2/1024/256 = 32. So the problems should start at 32 Hz already...

You can try to modify the ton.ccp file to allow it to use a 16-bit timer... This is already pre-programmed but not enabled....

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