qqqq

Dependencies:   HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH

Revision:
30:f300d1e88f4c
Parent:
29:eb84063fe5c9
Child:
32:c22cbcfb4635
--- a/main.cpp	Sun Nov 21 02:23:58 2021 +0000
+++ b/main.cpp	Fri Dec 03 11:09:33 2021 +0000
@@ -13,25 +13,6 @@
 Serial sat(USBTX,USBRX,9600);
 Timer sattime;
 int rcmd = 0,cmdflag = 0; //command variable
- 
-//getting command and flag
-void commandget()
-{
-    rcmd=com.getc();
-    cmdflag = 1;
-}
-//interrupting 
-void receive(int rcmd, int cmdflag)
-{
-    com.xbee.attach(commandget,Serial::RxIrq);
-}
-//initialzing
-void initialize()
-{
-    rcmd = 0;
-    cmdflag = 0;
-    condition = 0;
-}
 
 int main() {
     sat.printf("From Sat : Nominal Operation\r\n");
@@ -41,9 +22,10 @@
     float batvol, temp; //voltage, temperature 
     int rcmd=0,cmdflag=0;  //command variable
     sattime.start();
-    receive(rcmd,cmdflag); //interupting by ground station command
     eps.turn_on_regulator();//turn on 3.3V conveter
     for(int i = 0; i < 100; i++) {
+        com.xbee_receive(&rcmd,&cmdflag);//interupting by ground station command
+        
         //satellite condition led
         condition = !condition;
         
@@ -107,7 +89,7 @@
                 //Please insert your answer
 
             }
-            initialize();
+            com.initialize();
         }
     }
     sattime.stop();