pwm output on digital pin 0 or 1 on UNO

So there is a little project I am working on with a group and we are using a TFT LCD shield from Seeed Studio (its the v1 of their 2.8" TFT Touchscreen - no SD card). There only output pins we have left are 0 and 1. We would like to hook up a piezo buzzer and play notes based on the touchscreen input. I have seen a little bit of information on getting PWM output to any digital pin, but it looks like it will be difficult. Any suggestions would be much appreciated. We wanted to create a playNote(Note) function to send one of a series of previously defined notes (ie: middle C) to the buzzer.

Suggestions on how to modify the standard code (for sending a tone to the pins that automatically accept pwm output) so that we can send to pin 0 or 1 would be uber appreciated.

Thanks in advance.

You can make a tone on any digital pin... For example, if the pin is high for 1/2 of a millisecond and then low for 1/2 of a millisecond, and you repeat that pattern, you have a 1kHz square wave.

Like anything timing-related, you'll have to make sure the timing doesn't interact badly with your other code.

Another option is an actual "buzzer" (not a transducer) that makes a tone itself when you apply power.

If you are running out of pins I would first revisit the way you are using those you already have. You may be able to use them "smarter".

Are you for example, under the misapprehension that the "analog" pins are somehow not entirely usable as digital I/O pins?

Thanks for the responses.

The pin assignments for the LCD Touchscreen shield we are using are as follows::

D0 - Unused. D1 - Unused. D2 - LCD data bit 8. D3 - LCD data bit 9. D4 - LCD data bit 10. D5 - LCD data bit 11. D6 - LCD data bit 12. D7 - LCD data bit 13. D8 - LCD data bit 14. D9 - LCD data bit 15. D10 - LCD CS pin, active low. D11 - LCD RS pin. D12 - LCD WR pin. D13 - LCD RD pin.

D14(A0) - Touch Screen Y-. D15(A1) - Touch Screen X-. D16(A2) - Touch Screen Y+. D17(A3) - Touch Screen X+. D18(A4) - Unused. D19(A5) - Unused.

I am reading this as we have 2 digital output (non pwm) pins left that are not being utilized by the LCD. All the code I have seen for playing tones using a piezo buzzer indicate a pwm capable output pin is necessary. Is this really limited to the 6 pre-defined pins or is there a way to re-assign another pin as being pwm capable?


softpwm library to pins A4/5. If it doenst interference with timers used in your program,19451.0.html