Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH
Revision 33:d6e22ac4fb84, committed 2022-08-30
- Comitter:
- Yanagihara
- Date:
- Tue Aug 30 02:55:02 2022 +0000
- Parent:
- 32:c22cbcfb4635
- Commit message:
- maybe Lab5-6
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Aug 19 04:35:30 2022 +0000 +++ b/main.cpp Tue Aug 30 02:55:02 2022 +0000 @@ -3,6 +3,8 @@ #include "HEPTA_EPS.h" #include "HEPTA_SENSOR.h" #include "HEPTA_COM.h" +#include <stdlib.h> + HEPTA_CDH cdh(p5, p6, p7, p8, "sd"); HEPTA_EPS eps(p16,p26); HEPTA_SENSOR sensor(p17, @@ -23,7 +25,7 @@ int rcmd=0,cmdflag=0; //command variable sattime.start(); eps.turn_on_regulator();//turn on 3.3V conveter - for(int i = 0; i < 100; i++) { + while(1) { com.xbee_receive(&rcmd,&cmdflag);//interupting by ground station command //satellite condition led @@ -49,7 +51,7 @@ } //Contents of command if (cmdflag == 1) { - if (rcmd == 'a') { + if (rcmd == 'z') { sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); com.printf("Hepta-Sat Lite Uplink Ok\r\n"); for(int j=0;j<5;j++){ @@ -57,7 +59,7 @@ condition = 1; wait_ms(1000); } - }else if (rcmd == 'b') { + }else if (rcmd == 'y') { sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); com.printf("Hepta-Sat Lite Uplink Ok\r\n"); char str[100]; @@ -79,15 +81,25 @@ com.puts(str); } fclose(fp); - }else if (rcmd == 'c') { - //Please insert your answer + }else if (rcmd == 'a') { + sat.printf("rcmd=%c,cmdflag=%d\r\n",rcmd,cmdflag); + int myrand = (rand()%10) + 400; + char byte1 = (myrand&0xff00)>>8; + char byte2 = myrand&0x00ff; + com.printf("CO2 = %04d [ppm]\r\n",(byte1*256)+byte2); + /* + com.putc(0x03); + com.putc(0x45); + com.putc(0x13); + com.putc(0x10); + */ + wait_ms(1000); + }else if (rcmd == 'b') { + // TODO - }else if (rcmd == 'd') { - //Please insert your answer - - }else if (rcmd == 'e') { - //Please insert your answer - + }else if (rcmd == 'c') { + wait_ms(2000); + com.printf("Cal OK\r\n"); } com.initialize(); } @@ -96,3 +108,4 @@ sat.printf("From Sat : End of operation\r\n"); com.printf("From Sat : End of operation\r\n"); } +