Shell code for spinning LED using mbed
Dependencies: SDFileSystem mbed-rtos mbed wave_player
Fork of 6408proj_spin_LED by
main.cpp@0:6fdd6e6268f3, 2016-02-21 (annotated)
- Committer:
- taoqiuyang
- Date:
- Sun Feb 21 00:33:32 2016 +0000
- Revision:
- 0:6fdd6e6268f3
Shell code for spinning LED using mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taoqiuyang | 0:6fdd6e6268f3 | 1 | /* |
taoqiuyang | 0:6fdd6e6268f3 | 2 | ME6408 Project |
taoqiuyang | 0:6fdd6e6268f3 | 3 | Part2, spining LED, POV display module |
taoqiuyang | 0:6fdd6e6268f3 | 4 | */ |
taoqiuyang | 0:6fdd6e6268f3 | 5 | #include "mbed.h" |
taoqiuyang | 0:6fdd6e6268f3 | 6 | #include "rtos.h" |
taoqiuyang | 0:6fdd6e6268f3 | 7 | #include "SDFileSystem.h" //read SD card |
taoqiuyang | 0:6fdd6e6268f3 | 8 | #include "wave_player.h" //play sound |
taoqiuyang | 0:6fdd6e6268f3 | 9 | |
taoqiuyang | 0:6fdd6e6268f3 | 10 | SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card, |
taoqiuyang | 0:6fdd6e6268f3 | 11 | //in case RAM is not sufficient |
taoqiuyang | 0:6fdd6e6268f3 | 12 | AnalogOut DACout(p18); |
taoqiuyang | 0:6fdd6e6268f3 | 13 | wave_player waver(&DACout); |
taoqiuyang | 0:6fdd6e6268f3 | 14 | |
taoqiuyang | 0:6fdd6e6268f3 | 15 | Serial pc(USBTX, USBRX); // tx, rx, debug serial |
taoqiuyang | 0:6fdd6e6268f3 | 16 | Serial wireless_module(p28, p27); //wireless module connection |
taoqiuyang | 0:6fdd6e6268f3 | 17 | |
taoqiuyang | 0:6fdd6e6268f3 | 18 | InterruptIn photo_interrupt(p5); |
taoqiuyang | 0:6fdd6e6268f3 | 19 | |
taoqiuyang | 0:6fdd6e6268f3 | 20 | |
taoqiuyang | 0:6fdd6e6268f3 | 21 | //Declare LED array code here |
taoqiuyang | 0:6fdd6e6268f3 | 22 | |
taoqiuyang | 0:6fdd6e6268f3 | 23 | void photo_int_isr() { |
taoqiuyang | 0:6fdd6e6268f3 | 24 | |
taoqiuyang | 0:6fdd6e6268f3 | 25 | } |
taoqiuyang | 0:6fdd6e6268f3 | 26 | |
taoqiuyang | 0:6fdd6e6268f3 | 27 | int main(){ |
taoqiuyang | 0:6fdd6e6268f3 | 28 | photo_interrupt.rise(&photo_int_isr); // attach the address of the flip function to the rising edge |
taoqiuyang | 0:6fdd6e6268f3 | 29 | |
taoqiuyang | 0:6fdd6e6268f3 | 30 | while (true) { |
taoqiuyang | 0:6fdd6e6268f3 | 31 | |
taoqiuyang | 0:6fdd6e6268f3 | 32 | } |
taoqiuyang | 0:6fdd6e6268f3 | 33 | } |