I recently got an Arduino Leonardo and wanted speech output, so after some fighting with the code, I got Talkie running. (It took longer than it should have due to my trying to fix the PROGMEM const issue by just removing the PROGMEM keyword. Bad idea. Once I fixed that properly things went more smoothly.) I replaced Timer2 with Leonardo's Timer3, and the speaker connects to pin 5 instead of 3.
All changes would be in Talkie.cpp. For myself I just changed the code directly, but for your code something like an "#if defined (ARDUINO_AVR_LEONARDO) / #else / #endif might make the most sense.
Here are the changes in Talkie.cpp:
In Talkie::say(uint8_t* addr):
change:
pinMode(3,OUTPUT);
to:
pinMode(5,OUTPUT);
I recently got an Arduino Leonardo and wanted speech output, so after some fighting with the code, I got Talkie running. (It took longer than it should have due to my trying to fix the PROGMEM const issue by just removing the PROGMEM keyword. Bad idea. Once I fixed that properly things went more smoothly.) I replaced Timer2 with Leonardo's Timer3, and the speaker connects to pin 5 instead of 3.
All changes would be in Talkie.cpp. For myself I just changed the code directly, but for your code something like an "#if defined (ARDUINO_AVR_LEONARDO) / #else / #endif might make the most sense.
Here are the changes in Talkie.cpp: In Talkie::say(uint8_t* addr): change: pinMode(3,OUTPUT); to: pinMode(5,OUTPUT);
change: TCCR2A = _BV(COM2B1) | _BV(WGM21) | _BV(WGM20); TCCR2B = _BV(CS20); TIMSK2 = 0; to: TCCR3A = _BV(COM3A1) | _BV(WGM30); TCCR3B = _BV(WGM32) | _BV(CS30); TIMSK3 = 0;
In ISR(TIMER1_COMPA_vect): change: OCR2B = nextPwm; to: OCR3A = nextPwm;
That's it. Thanks for creating Talkie!