Igor Padjen
/
hrv_himna
hrv_himna
main.cpp
- Committer:
- ipadjen
- Date:
- 2015-12-10
- Revision:
- 0:ebf720f1cb0c
File content as of revision 0:ebf720f1cb0c:
#include "mbed.h" PwmOut buzzer(p21); //frekvencija melodije "Lijepa naša" float frequency[]= {659.3, 659.3, 659.3, 587.3, 587.3, 523.3, 523.3, 392, 349.2, 329.6, 349.2, 392, 440, 392, 349.2, 329.6, 349.2, 392, 659.3, 659.3, 659.3, 587.3, 587.3, 523.3, 523.3, 392, 349.2, 329.6, 349.2, 392, 440, 493.9, 493.9, 587.3, 523.3, 493.9, 493.9, 493.9, 440, 493.9, 493.9, 523.3, 587.3, 493.9, 587.3, 587.3, 587.3, 587.3, 587.3, 523.3, 493.9, 440, 392, 659.3, 659.3, 659.3, 587.3, 587.3, 523.3, 523.3, 392, 349.2, 329.6, 349.2, 392, 440, 493.9, 493.9, 587.3, 523.3, 0 }; //trajanje nota float beat[]= {1, 1, 1.5, 0.5, 0.5, 0.5, 1, 2, 0.5, 0.5, 0.5, 0.5, 2, 0.5, 0.5, 0.5, 0.5, 2, 1, 1, 1.5, 0.5, 0.5, 0.5, 1, 2, 0.5, 0.5, 0.5, 0.5, 2, 0.5, 0.5, 1, 2, 1, 1, 1.5, 0.5, 1, 0.5, 0.5, 1.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 2, 1, 1, 1.5, 0.5, 0.5, 0.5, 1, 2, 0.5, 0.5, 0.5, 0.5, 2, 0.5, 0.5, 1, 2, 0.5 }; int main() { while (1) { for (int i=0; i<=70; i++) { buzzer.period(1/(frequency[i])); // set PWM period buzzer=0.5; // set duty cycle wait(0.5*beat[i]); // hold for beat period } } }