On Arduino Uno Rev3, I just ran the
speaker_pcm demo that used TIMER1 and TIMER2 to generate a PWM wave. However, this means that the Pins 3, 9, 10 and 11 can not be used anymore; according to the documentation:
Takes over Timer 1 (16-bit) for the 8000 Hz timer. This breaks PWM (analogWrite()) for Arduino pins 9 and 10. Takes Timer 2 (8-bit) for the pulse width modulation, breaking PWM for pins 11 & 3.
I wanted to change the program such that the WAV data was read from a SD card. However, this is what documentation for
SD.h library says:
The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards)
This means both the
speaker_pcm want to use pin 11, and the requirement to use these pins is dictated by the hardware. I am guessing that this clash will create problems.
Is there any way I can make this work? Can I switch between SD card reading and Audio playing somehow (essentially multiplexing in software)? Or will this collision of pin usage not be a problem?