XBEE recepteur

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pathae
Date:
Wed Oct 20 17:20:21 2021 +0000
Commit message:
xbee recepteur

Changed in this revision

mbed.bld Show annotated file Show diff for this revision Revisions of this file
recept_xbee.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 64198fe0cc54 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 20 17:20:21 2021 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c
\ No newline at end of file
diff -r 000000000000 -r 64198fe0cc54 recept_xbee.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/recept_xbee.cpp	Wed Oct 20 17:20:21 2021 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include <stdlib.h>
+
+Serial xbee(PA_9,PA_10); //Initalise xbee_lib
+Serial pc(USBTX, USBRX); //Initalise PC serial comms
+int i=0;
+char recu[8]; 
+
+int main()
+{
+
+ while(1) {
+        //attente de la chaine $MESUR
+        while (xbee.getc()!='$');
+        while (xbee.getc()!='M');
+        while (xbee.getc()!='E');
+        while (xbee.getc()!='S');
+        while (xbee.getc()!='U');
+        while (xbee.getc()!='R');
+        while (xbee.getc()!=',');
+        while(i<8)
+            {
+            recu[i]=xbee.getc();
+            pc.printf("J'ai recu %i\n\r",recu[i]);
+            i=i+1;
+            }
+            i=0;
+      wait(1);
+    }
+}