Go Down

Topic: toneMelody problem in 0019 (Read 904 times) previous topic - next topic


Sep 06, 2010, 02:53 am Last Edit: Sep 06, 2010, 04:53 am by MaineTim Reason: 1
Newbie poster here: hope I'm putting this in the right place! Maybe it should be under Bugs, but... :)

I just started with the Arduino a few days ago, and was using version 0018. The toneMelody example in that version loaded and executed just fine. Today I switched over to version 0019, and found that when toneMelody is executed, only the first note is correct. The following notes do play, but the pitch is (way) wrong. I checked the tone values being used via serial monitor and they are the same.
I see that one of the changes made in 0019 was to the tone() function, and I wonder what needs to be done to get the code to work correctly again?

I'm using a Duemilanove, BTW. Thanks... Tim


Oct 12, 2010, 03:16 pm Last Edit: Oct 12, 2010, 10:02 pm by condemned Reason: 1
This looks to be a bug in tone(), introduced in 0019 (whilst fixing "Issue 228: PWM remains disabled after tone() ends".)

A temporary work-round would be to insert noTone(8); just before the tone comand. That'll work because it ensures that the underlying timer is re-initialised correctly on subsequent tone calls.

[edit: the issue is already logged : Issue 361 : tone command no longer plays frequencies accurately]

Go Up