for baska
Dependencies: Hepta9axis HeptaBattery HeptaCamera_GPS HeptaTemp HeptaXbee SDFileSystem mbed
Fork of Lab1-04_model_program_1 by
main.cpp
- Committer:
- HEPTA
- Date:
- 2018-08-08
- Revision:
- 17:ccae1368497e
- Parent:
- 13:a1fa75a002f6
- Child:
- 19:7d54c7b47fd8
File content as of revision 17:ccae1368497e:
#include "mbed.h" Serial pc(USBTX,USBRX); DigitalOut myleds[] = {LED1,LED2,LED3,LED4};; int rcmd = 0,cmdflag = 0; void commandget() { rcmd=pc.getc(); cmdflag = 1; } void receive(int *xrcmd, int *xcmdflag) { pc.attach(commandget,Serial::RxIrq); *xrcmd = rcmd; *xcmdflag = cmdflag; } void initialize() { rcmd = 0; cmdflag = 0; } int main() { pc.baud(9600); while(1) { myleds[0] = 1; wait(0.5); myleds[0] = 0; wait(0.5); receive(&rcmd,&cmdflag); if (cmdflag == 1) { if (rcmd == 'a') { } initialize(); } } }