thomas strcic
/
ProjetInfo2_Multi12
oki
Fork of ProjetInfo2_Multi by
music.h
- Committer:
- thomasstrcic
- Date:
- 2018-06-05
- Revision:
- 3:98f5de1dd010
- Parent:
- 2:ae058dfdebac
File content as of revision 3:98f5de1dd010:
// Oranges and Lemons program #include "mbed.h" PwmOut HP(p21); void music (void); int y=0; float frequence[]={659,554,659,554,550,494,554,587, 494,659,554,440}; //frequency array float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2}; //beat array void music() { for (int i=0; i<=11; i++) { HP.period(1/(frequence[i])); // set PWM period HP.write(0.5); // set duty cycle wait(0.5*beat[i]); // hold for beat period y++; } HP.period(0); y=0; }