const uint16_t music[] =
{
8,
4, A5, 2, A5, 2, G5, 4, E5, 2, E5, 2, D5, 8, C5, 8, C5,
4, E5, 2, E5, 2, D5, 4, C5, 2, A4, 2, G4, 8, G4, 8, G4,
4, G4, 2, G4, 2, A4, 4, G4, 2, G4, 2, A4, 4, C4, 2, C4,
2, D4, 4, E5, 4, G5, 4, A4, 2, A4, 2, G4, 2, E5, 2, D5,
4, C5, 8, D5,
0, 1
};
uint16_t i, dat;
uint16_t LEN;
double T;
int main()
{
LEN = sizeof(music)/2;
T = music[0];
i = 0;
while(1) {
if(i >= LEN/2)
i = 0;
dat = music[i*2+2];
if(dat != P)
PWM.period_us(dat);
else
PWM.period_us(10);
PWM = POT;
wait(music[i*2+1]/T);
i++;
}
}