Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tone lower than ~40 Hz doesn't work #547

Open
NikilRagav opened this issue Jul 16, 2020 · 3 comments
Open

Tone lower than ~40 Hz doesn't work #547

NikilRagav opened this issue Jul 16, 2020 · 3 comments

Comments

@NikilRagav
Copy link

I see no technical reason why this shouldn't work.

Assuming the generic timer clock is 8MHz, then tone() should be able to support as low a frequency as .11Hz with a 16 bit timer by my calculation

(my goal is to use it to flash an LED 3 times in one second, but it doesn't seem to work on my Sparkfun Qwiic Micro which is a SAMD21 board).

As per the formula in the function, at 3Hz, (8E6/2)/3/(2^6) < 0xFFFF, so it should work right? Am I making a calculation error?

Side note (Potentially adding an overflow counter could be pretty useful for longer tone durations)

@NikilRagav
Copy link
Author

Actually, doing some more investigation on this,

tone(1 /Hz/) works with any duration

tone(2) and higher seem to just result in the LED being constantly lit, no frequency at all

@NikilRagav
Copy link
Author

also a nice feature would be to be able to invert the order (high then low)

@ZombieFodder
Copy link

This might be related to an issue I raised with Adafruit fork of this repo:
adafruit#371

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants