Grenade Drone Controller
Dependencies: mbed
GranadeCtrl.cpp@0:4194aba3f887, 2018-07-16 (annotated)
- Committer:
- halusis
- Date:
- Mon Jul 16 06:49:15 2018 +0000
- Revision:
- 0:4194aba3f887
- Child:
- 1:903bcc4d9628
1st Complete Ver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halusis | 0:4194aba3f887 | 1 | #include "mbed.h" |
halusis | 0:4194aba3f887 | 2 | #include "PinAssign.h" |
halusis | 0:4194aba3f887 | 3 | #include "GlobalVars.h" |
halusis | 0:4194aba3f887 | 4 | #include "Functions.h" |
halusis | 0:4194aba3f887 | 5 | |
halusis | 0:4194aba3f887 | 6 | bool fSndTimer=0; |
halusis | 0:4194aba3f887 | 7 | |
halusis | 0:4194aba3f887 | 8 | Timeout SndTimer; |
halusis | 0:4194aba3f887 | 9 | void SndTimer_isr(void) {fSndTimer=1;} |
halusis | 0:4194aba3f887 | 10 | |
halusis | 0:4194aba3f887 | 11 | int main() |
halusis | 0:4194aba3f887 | 12 | { |
halusis | 0:4194aba3f887 | 13 | SndTimer.attach(&SndTimer_isr,1); |
halusis | 0:4194aba3f887 | 14 | InitPWM(); |
halusis | 0:4194aba3f887 | 15 | |
halusis | 0:4194aba3f887 | 16 | pc.baud(115200); |
halusis | 0:4194aba3f887 | 17 | Switch.baud(9600); |
halusis | 0:4194aba3f887 | 18 | |
halusis | 0:4194aba3f887 | 19 | while(1) |
halusis | 0:4194aba3f887 | 20 | { |
halusis | 0:4194aba3f887 | 21 | if(fSndTimer==1) |
halusis | 0:4194aba3f887 | 22 | { |
halusis | 0:4194aba3f887 | 23 | fSndTimer=0; |
halusis | 0:4194aba3f887 | 24 | |
halusis | 0:4194aba3f887 | 25 | SndPWM(); |
halusis | 0:4194aba3f887 | 26 | SigBit=RcvBit; |
halusis | 0:4194aba3f887 | 27 | Switch.putc(SigBit); |
halusis | 0:4194aba3f887 | 28 | |
halusis | 0:4194aba3f887 | 29 | } |
halusis | 0:4194aba3f887 | 30 | |
halusis | 0:4194aba3f887 | 31 | if(Switch.readable()) RcvProc(); |
halusis | 0:4194aba3f887 | 32 | } |
halusis | 0:4194aba3f887 | 33 | } |