for textbook v4.4

Dependencies:   mbed HEPTA_COM

Files at this revision

API Documentation at this revision

Comitter:
HeptaSatTraining2019
Date:
Tue Aug 27 02:32:45 2019 +0000
Parent:
25:5fd40a170032
Commit message:

Changed in this revision

HEPTA_CDH.lib Show diff for this revision Revisions of this file
HEPTA_EPS.lib Show diff for this revision Revisions of this file
HEPTA_SENSOR.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HEPTA_CDH.lib	Tue Aug 27 01:15:05 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_EPS.lib	Tue Aug 27 01:15:05 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/users/HeptaSatTraining2019/code/HEPTA_EPS/#4f08f55763c7
--- a/HEPTA_SENSOR.lib	Tue Aug 27 01:15:05 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	Tue Aug 27 01:15:05 2019 +0000
+++ b/main.cpp	Tue Aug 27 02:32:45 2019 +0000
@@ -1,23 +1,26 @@
 #include "mbed.h"
-#include "HEPTA_EPS.h"
-#include "HEPTA_CDH.h"
-#include "HEPTA_SENSOR.h"
 #include "HEPTA_COM.h"
 
 Serial pc(USBTX,USBRX);
-HEPTA_EPS eps(p16,p26);
-HEPTA_CDH cdh(p5,p6,p7,p8,"sd");
-HEPTA_SENSOR sensor(p17, 
-                    p28,p27,0xD0,0x18,
-                    p13,p14,p25,p24);
 HEPTA_COM com(p9,p10);
 
-DigitalOut myled(LED1);
-
 int main()
 {
-    myled = 1;
-    wait(0.5);
-    myled = 0;
-    wait(0.5);
+    pc.baud(9600);
+    com.baud(9600);
+    pc.printf("Xbee Uplink Ok Mode\r\n");
+    int rcmd=0,cmdflag=0;
+    for(int i = 0; i < 10; i++) {
+        com.printf("num = %d\r\n",i);
+        com.xbee_receive(&rcmd,&cmdflag);
+        pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag);
+        if (cmdflag == 1) {
+            if (rcmd == 'a') {
+                pc.printf("Command Get %d\r\n",rcmd);
+                com.printf("HEPTA Uplink OK\r\n");
+            }
+            com.initialize();
+        }
+        wait(1.0);
+    }
 }
\ No newline at end of file