Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get Talkie running on Arduino Leonardo #19

Open
AndreNeedham opened this issue Jul 26, 2016 · 1 comment
Open

How to get Talkie running on Arduino Leonardo #19

AndreNeedham opened this issue Jul 26, 2016 · 1 comment

Comments

@AndreNeedham
Copy link

AndreNeedham commented Jul 26, 2016

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!

@reaganry
Copy link

confirmed this works on mega. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants