Projet Drone de surveillance du labo TRSE (INGESUP)

Dependencies:   mbed PID ADXL345 Camera_LS_Y201 ITG3200 RangeFinder mbos xbee_lib Motor Servo

Revision:
35:95cb34636703
Parent:
34:4466839f5bb7
--- a/main.cpp	Wed Mar 19 09:18:53 2014 +0000
+++ b/main.cpp	Wed Mar 19 09:27:19 2014 +0000
@@ -1,3 +1,54 @@
+#define MAVLINK_TEST 1
+
+#if MAVLINK_TEST
+
+#include "mbed.h"
+#include "xbee.h"
+#include "MAVLink_API/MAVLink_API.h"
+#include "MAVlink/include/common/common.h"
+#include "mbos.h"
+#include "os.h"
+ 
+Serial pc(USBTX, USBRX);
+mavLink_API mvlk(2.0);
+mbos os(3, 2); //os just for compiling
+//xbee myXbee(p9, p10, p11);
+ 
+ 
+ int main() {
+
+     pc.baud(38400);
+
+    while(1){
+        if(mvlk.messageReadyToBeSent)
+        {
+            for(int i = 0 ; i < mvlk.len ; i++){
+                pc.putc(mvlk.buf[i]);
+            }
+            mvlk.messageReadyToBeSent = false;
+        }
+        while(pc.readable()){
+            mvlk.getMessage(pc.getc());
+        }
+        //pc.printf("size : %d\n", len);
+        //myXbee.SendData((char*)buf, (int)len);
+        //pc.puts((const char*)buf);
+        //for(int i = 0 ; i < len ; i++){
+            //pc.putc(buf[i]);
+        //}
+        //pc.putc(buf[len-2]);
+        
+        wait(1.0); 
+    }
+
+    /*for(int i = 0 ; i < len ; i++){
+            pc.printf("%x ", buf[i]);
+    }
+    pc.printf("\n\r");*/
+}
+//uart0_send(buf, len);
+#else
+
  /* Copyright (c) 2012 - 2013 Gaëtan PLEYBER
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 
@@ -101,3 +152,5 @@
         if(os.GetEvent() & COMMUNICATION_EVENT) led3 = !led3;
    }
 }*/
+
+#endif