void audioOn() {
// Set up PWM to 31.25kHz, phase accurate
TCCR2A = _BV(COM2A1) | _BV(WGM20);
TCCR2B = _BV(CS20);
TIMSK2 = _BV(TOIE2);
}
to
void audioOn() {
// Set up PWM to 31.25kHz, phase accurate
TCCR0A = _BV(COM0B1) | _BV(WGM00);
TCCR0B = _BV(CS00);
TIMSK = _BV(TOIE0);
}
}
What else do I need to change?
I have to admit I don't really understand parts of this program.
I don't really understand how the LED pin is used in this sketch for instance...
But I would love to get it running on a Attiny...
Sorry to reopen an old thread, but were these the only changes necessary to port Auduino to the Attiny85? I'm trying to do it with an Adafruit Trinket (the 5V Attiny85 version, not the Pro) and keep running into issues with the timer definition.
C:\Users\Paul\AppData\Local\Temp\build127568103313271913.tmp/core.a(wiring.c.o): In function __vector_5': Z:\arduino-1.6.4\hardware\arduino\avr\cores\arduino/wiring.c:49: multiple definition of __vector_5'
TinyGrains.cpp.o:Z:\arduino-1.6.4/TinyGrains.ino:119: first defined here
collect2.exe: error: ld returned 1 exit status
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Looks like they are referring to the Timer0 Overflow vector. Arduino uses Timer0 (in wiring.c) for the millis() timer. Looks like "TinyGrains.ino" is using it for PWM. Maybe a different core is assumed by the sketch.