Hello, I'm using the TVout library for a project which uses its own built-in tone() function, but unfortunately it's hard coded to use pin 11 (on UNO) for output. I was wondering if it was possible to modify the library to use a different pin for output? Specifically pin5, which is also a digital PWM.
I'm looking through the cpp file:
And I've found the tone function, but I'm not sure how (if it's possible) to change the pin?
Would anyone be able to offer a recommendation on this? Thank you for your help!
Pin 5, which you want to use instead of pin 11, belongs to timer0 which is used for millis(), delay() etc. so is difficult to reuse.
What do you want to use pin 11 for ? It may be easier to change that other application.
The other alternative may be a board, such as the Arduino Mega, which has more timers available.
Mmmm, from the documentation, "On...UNO...the sync is pin 9, video on 7 and audio on 11", and I've confirmed this in my tests; I think maybe you're looking at pins for one of the other Arduino MCUs? But the reason I was hoping to use 5 was because I had a PCB made with pin headers that plugs into the top of the Arduino, and didn't realize that TVout both has and requires you to use it's built-in tone() function. It's not a big deal if not, I can just cut the header off from pin 5 and run a loose wire, was just curious if there was a way to avoid this
But, anyway, a quick hardware change is certainly the best solution here. Only if you had 100's of boards made would it be worth trying to get a software fix.