HEPTA-Sat Training 2019
/
Lab3-02_Detect_BatteryVoltage
Lab3
Revision 25:4277e16b97c3, committed 2019-08-21
- Comitter:
- HeptaSatTraining2019
- Date:
- Wed Aug 21 18:14:40 2019 +0000
- Parent:
- 24:3659e0c223c8
- Commit message:
Changed in this revision
--- a/HEPTA_CDH.lib Wed Aug 21 18:02:15 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/HeptaSatTraining2019/code/HEPTA_CDH/#58ce2bfde7a8
--- a/HEPTA_COM.lib Wed Aug 21 18:02:15 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/HeptaSatTraining2019/code/HEPTA_COM/#1838cbd7d223
--- a/HEPTA_SENSOR.lib Wed Aug 21 18:02:15 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/HeptaSatTraining2019/code/HEPTA_SENSOR/#9023eea2a66e
--- a/main.cpp Wed Aug 21 18:02:15 2019 +0000 +++ b/main.cpp Wed Aug 21 18:14:40 2019 +0000 @@ -1,53 +1,16 @@ #include "mbed.h" -#include"HEPTA_EPS.h" -#include"HEPTA_CDH.h" -#include"HEPTA_SENSOR.h" -#include"HEPTA_COM.h" - -#include "mbed.h" +#include "HEPTA_EPS.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; -} +HEPTA_EPS eps(p16,p26); int main() { pc.baud(9600); - receive(&rcmd,&cmdflag); - while(1) { - myleds[0] = 1; - wait(0.5); - myleds[0] = 0; - wait(0.5); - if (cmdflag == 1) { - if (rcmd == 'a') { - //Please enter your answer in this part - - - - // - } - initialize(); - } + float bt; + for(int i = 0; i < 10; i++) { + eps.vol(&bt); + pc.printf("Vol = %f\r\n",bt); + wait(1.0); } } \ No newline at end of file