Beep RTTL done + ints.
Dependencies: MCP23017 aconno_bsp beep_2
Fork of acd52832_beep_buzzer by
main.cpp@0:79fc9d7d880f, 2016-09-22 (annotated)
- Committer:
- jurica238814
- Date:
- Thu Sep 22 18:11:58 2016 +0000
- Revision:
- 0:79fc9d7d880f
- Child:
- 2:bc9245345c12
Beep RTTL done.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:79fc9d7d880f | 1 | |
jurica238814 | 0:79fc9d7d880f | 2 | #include "mbed.h" |
jurica238814 | 0:79fc9d7d880f | 3 | #include "beep.h" |
jurica238814 | 0:79fc9d7d880f | 4 | #include "acd52832_bsp.h" |
jurica238814 | 0:79fc9d7d880f | 5 | #include "notes.h" |
jurica238814 | 0:79fc9d7d880f | 6 | |
jurica238814 | 0:79fc9d7d880f | 7 | |
jurica238814 | 0:79fc9d7d880f | 8 | Beep buzzer(PIN_BUZZER); |
jurica238814 | 0:79fc9d7d880f | 9 | DigitalOut LED (p26); |
jurica238814 | 0:79fc9d7d880f | 10 | DigitalOut RED (PIN_LED_RED); |
jurica238814 | 0:79fc9d7d880f | 11 | |
jurica238814 | 0:79fc9d7d880f | 12 | |
jurica238814 | 0:79fc9d7d880f | 13 | |
jurica238814 | 0:79fc9d7d880f | 14 | char *song = "Greensleaves:d=4,o=5,b=140:g,2a#,c6,d.6,8d#6,d6,2c6,a,f.,8g,a,2a#,g,g.,8f,g,2a,f,2d,g,2a#,c6,d.6,8e6,d6,2c6,a,f.,8g,a,a#.,8a,g,f#.,8e,f#,2g"; |
jurica238814 | 0:79fc9d7d880f | 15 | |
jurica238814 | 0:79fc9d7d880f | 16 | |
jurica238814 | 0:79fc9d7d880f | 17 | |
jurica238814 | 0:79fc9d7d880f | 18 | int main(){ |
jurica238814 | 0:79fc9d7d880f | 19 | |
jurica238814 | 0:79fc9d7d880f | 20 | LED = 1; |
jurica238814 | 0:79fc9d7d880f | 21 | RED = 1; |
jurica238814 | 0:79fc9d7d880f | 22 | buzzer.playRttl(song); |
jurica238814 | 0:79fc9d7d880f | 23 | RED = 0; |
jurica238814 | 0:79fc9d7d880f | 24 | |
jurica238814 | 0:79fc9d7d880f | 25 | while(1){ |
jurica238814 | 0:79fc9d7d880f | 26 | LED = 0; |
jurica238814 | 0:79fc9d7d880f | 27 | wait(0.1); |
jurica238814 | 0:79fc9d7d880f | 28 | LED = 1; |
jurica238814 | 0:79fc9d7d880f | 29 | wait(0.1); |
jurica238814 | 0:79fc9d7d880f | 30 | } |
jurica238814 | 0:79fc9d7d880f | 31 | } |