Stap 3:
Vervolgens kopieert u het volgende:
#include "pitches.h"
int melodie [] {} =
NOTE_E3, NOTE_E4, NOTE_D4, NOTE_E4, NOTE_G4, NOTE_D4, NOTE_B4, NOTE_A4, NOTE_G4, NOTE_D4, NOTE_D4, NOTE_C4, NOTE_B3, NOTE_G3, NOTE_E3, NOTE_D3, NOTE_E3, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_B4, NOTE_G4, NOTE_E4, NOTE_D5,
NOTE_E4, NOTE_D4, NOTE_E4, NOTE_G4, NOTE_D4, NOTE_B4, NOTE_A4, NOTE_G4, NOTE_D4, NOTE_D4, NOTE_C4, NOTE_B3, NOTE_G3, NOTE_E3, NOTE_D3, NOTE_E3, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_B4, NOTE_G4, NOTE_E4, NOTE_D5,
NOTE_G3, NOTE_G3, NOTE_G3, NOTE_D4, NOTE_B3, NOTE_B3, NOTE_B3, NOTE_B3, NOTE_G3, NOTE_A3, NOTE_B3, NOTE_D4, NOTE_B3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_D4, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, NOTE_FS3, NOTE_E3,
NOTE_G3, NOTE_G3, NOTE_G3, NOTE_D4, NOTE_B3, NOTE_B3, NOTE_B3, NOTE_B3, NOTE_G3, NOTE_A3, NOTE_B3, NOTE_D4, NOTE_B3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_D4, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, NOTE_G3, NOTE_G3, NOTE_G3, 0,
NOTE_E1, NOTE_A2, NOTE_E1, NOTE_E1, NOTE_E1, NOTE_E1,
NOTE_E1, NOTE_A2, NOTE_E1, NOTE_E1, NOTE_E1, NOTE_E1,
};
int noteDurations [] {} =
6,6,6,6,3,6,6,6,6,3,6,6,6,6,6,6,6,6,6,6,6,6,6,6,2,
6,6,6,3,6,6,6,6,3,6,6,6,6,6,6,6,6,6,6,6,6,6,6,2,
6,6,6,2,2,6,6,6,6,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,2,2,6,6,6,6,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,2,2,
1,2,4,4,1,1,
1,2,4,4,1,1,
};
VOID Setup {}
voor (int thisNote = 0; thisNote < 120; thisNote ++) {}
int noteDuration = 1000/noteDurations [thisNote];
Toon (11, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(11);
}
}
void loop {}
}
en stijfsel op voor naar de Arduino software.