Projet de marde tu touche tes gay

Dependencies:   WebSocketClient XBeeLib

Files at this revision

API Documentation at this revision

Comitter:
jfontaine
Date:
Tue Apr 10 19:49:45 2018 +0000
Parent:
4:5731c7953ba7
Commit message:
have faith

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5731c7953ba7 -r 252b899d1097 main.cpp
--- a/main.cpp	Tue Apr 10 18:45:09 2018 +0000
+++ b/main.cpp	Tue Apr 10 19:49:45 2018 +0000
@@ -14,12 +14,24 @@
 using namespace XBeeLib;
 
 Serial pc(USBTX,USBRX);
-
+uint8_t lensFrame[121] = {0};
 void nodeDiscovery(const RemoteXBeeZB& remote, char const * const node_id)
 {
     pc.printf("Found device '%s'\r\n", node_id);
 }
 
+void receiveImage(const RemoteXBeeZB& remote, bool broadcast, const uint8_t *const data, uint16_t len)
+{
+    pc.printf("%d",len);
+    for(uint8_t index =0;index<len;index++)
+    {
+        lensFrame[index] = data[index];
+    }
+    for(uint8_t i =0;i<121;i++)
+    {
+        pc.printf("%d",lensFrame[i]);
+    }
+}    
 int main() 
 {
     bool exit = false;
@@ -32,6 +44,7 @@
     pc.printf("XBee init done\n");
     pc.printf("Discovering...\n");
     xbee.register_node_discovery_cb(&nodeDiscovery);
+    xbee.register_receive_cb(&receiveImage);
     xbee.config_node_discovery(1000,true);              //setting the timeout to 1000ms and enabling the auto-discovery.
     xbee.start_node_discovery();
     do{