for_20211114

Dependencies:   HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH

Committer:
HeptaSatTraining2019
Date:
Wed Aug 21 18:02:15 2019 +0000
Revision:
24:3659e0c223c8
Parent:
21:92c25e853b87
Child:
25:ccc5ff675e0c

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:bdbd3d6fc5d5 1 #include "mbed.h"
HeptaSatTraining2019 21:92c25e853b87 2 #include"HEPTA_EPS.h"
HeptaSatTraining2019 21:92c25e853b87 3 #include"HEPTA_CDH.h"
HeptaSatTraining2019 21:92c25e853b87 4 #include"HEPTA_SENSOR.h"
HeptaSatTraining2019 21:92c25e853b87 5 #include"HEPTA_COM.h"
umeume 2:1c5cdb2c3e0f 6
HeptaSatTraining2019 24:3659e0c223c8 7 #include "mbed.h"
HeptaSatTraining2019 24:3659e0c223c8 8
umeume 2:1c5cdb2c3e0f 9 Serial pc(USBTX,USBRX);
HeptaSatTraining2019 24:3659e0c223c8 10
HeptaSatTraining2019 24:3659e0c223c8 11 DigitalOut myleds[] = {LED1,LED2,LED3,LED4};;
HeptaSatTraining2019 24:3659e0c223c8 12
HeptaSatTraining2019 24:3659e0c223c8 13 int rcmd = 0,cmdflag = 0;
HeptaSatTraining2019 24:3659e0c223c8 14
HeptaSatTraining2019 24:3659e0c223c8 15 void commandget()
HeptaSatTraining2019 24:3659e0c223c8 16 {
HeptaSatTraining2019 24:3659e0c223c8 17 rcmd=pc.getc();
HeptaSatTraining2019 24:3659e0c223c8 18 cmdflag = 1;
HeptaSatTraining2019 24:3659e0c223c8 19 }
HeptaSatTraining2019 24:3659e0c223c8 20 void receive(int *xrcmd, int *xcmdflag)
HeptaSatTraining2019 24:3659e0c223c8 21 {
HeptaSatTraining2019 24:3659e0c223c8 22 pc.attach(commandget,Serial::RxIrq);
HeptaSatTraining2019 24:3659e0c223c8 23 *xrcmd = rcmd;
HeptaSatTraining2019 24:3659e0c223c8 24 *xcmdflag = cmdflag;
HeptaSatTraining2019 24:3659e0c223c8 25 }
HeptaSatTraining2019 24:3659e0c223c8 26
HeptaSatTraining2019 24:3659e0c223c8 27 void initialize()
HeptaSatTraining2019 24:3659e0c223c8 28 {
HeptaSatTraining2019 24:3659e0c223c8 29 rcmd = 0;
HeptaSatTraining2019 24:3659e0c223c8 30 cmdflag = 0;
HeptaSatTraining2019 24:3659e0c223c8 31 }
HeptaSatTraining2019 24:3659e0c223c8 32
umeume 2:1c5cdb2c3e0f 33 int main()
umeume 2:1c5cdb2c3e0f 34 {
HeptaSatTraining2019 24:3659e0c223c8 35 pc.baud(9600);
HeptaSatTraining2019 24:3659e0c223c8 36 receive(&rcmd,&cmdflag);
HeptaSatTraining2019 24:3659e0c223c8 37 while(1) {
HeptaSatTraining2019 24:3659e0c223c8 38 myleds[0] = 1;
HeptaSatTraining2019 24:3659e0c223c8 39 wait(0.5);
HeptaSatTraining2019 24:3659e0c223c8 40 myleds[0] = 0;
HeptaSatTraining2019 24:3659e0c223c8 41 wait(0.5);
HeptaSatTraining2019 24:3659e0c223c8 42 if (cmdflag == 1) {
HeptaSatTraining2019 24:3659e0c223c8 43 if (rcmd == 'a') {
HeptaSatTraining2019 24:3659e0c223c8 44 //Please enter your answer in this part
HeptaSatTraining2019 24:3659e0c223c8 45
HeptaSatTraining2019 24:3659e0c223c8 46
HeptaSatTraining2019 24:3659e0c223c8 47
HeptaSatTraining2019 24:3659e0c223c8 48 //
HeptaSatTraining2019 24:3659e0c223c8 49 }
HeptaSatTraining2019 24:3659e0c223c8 50 initialize();
HeptaSatTraining2019 24:3659e0c223c8 51 }
HeptaSatTraining2019 24:3659e0c223c8 52 }
umeume 2:1c5cdb2c3e0f 53 }