I have gotten the blink sketch to work before (using the Attiny85 core from the MIT HLT tutorial). But that's moot now, I have another update on the progress...
I got the sketch to upload and it plays through the iteration on a piezo! However, it iterates only once through the "void loop" function then sticks on that last "note" in the list. It's as if the loop function isn't working (or like the ATtiny85 doesn't support the loop function?). Can anyone see anything wrong with the code itself or is this still a hardware issue with the Attiny85? I haven't changed the code at all (except for the pin out # to match the corresponding ATtiny85 pin) since I successfully tested it on the Arduino UNO board.
Here's the code again for reference:
#include "pitches.h"
int melody[] = {
NOTE_CS4, 0, NOTE_CS8, 0, NOTE_CS4, 0, NOTE_CS8, 0, NOTE_EE, 0, NOTE_DS8, 0, NOTE_EE, 0, NOTE_DS8, 0,
NOTE_CS4, 0, NOTE_CS8, 0, NOTE_CS4, 0, NOTE_CS8, 0, NOTE_EE, 0, NOTE_DS8, 0, NOTE_EE, 0, NOTE_DS8, 0,
NOTE_DS7, 0, NOTE_DS8, 0, NOTE_DS7, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0,
NOTE_DS7, 0, NOTE_DS8, 0, NOTE_DS7, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0,
NOTE_CS5, 0, NOTE_DS8, 0, NOTE_CS5, 0, NOTE_DS8, 0, NOTE_GG, 0, NOTE_DS8, 0, NOTE_GG, 0, NOTE_DS8, 0,
NOTE_CS5, 0, NOTE_DS8, 0, NOTE_CS5, 0, NOTE_DS8, 0, NOTE_GG, 0, NOTE_DS8, 0, NOTE_GG, 0, NOTE_DS8, 0,
NOTE_DS7, 0, NOTE_DS8, 0, NOTE_DS7, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0,
NOTE_DS7, 0, NOTE_DS8, 0, NOTE_DS7, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0, NOTE_FF, 0, NOTE_DS8, 0, };
int noteDurations[] = {
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80, 30, 80,
30, 80, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, };
void setup() {
}
void loop() {
for (int thisNote = 0; thisNote < 128; thisNote++) {
int noteDuration = 100/noteDurations[thisNote];
tone(0, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.20;
delay(pauseBetweenNotes);
noTone(0);
}
}