mobile robot control with artificial hormones

Dependencies:   Communication_Robot RTC-DS1307 iSerial mbed

Fork of Andante_v00 by potiwat ngamkajornwiwat

Revision:
3:12f2ee26a43f
Parent:
2:b31c4677ebc0
Child:
4:42dc950d54f4
--- a/main.cpp	Sun Mar 01 08:50:37 2015 +0000
+++ b/main.cpp	Sun Mar 01 15:41:24 2015 +0000
@@ -26,12 +26,6 @@
     heading_rear.period_ms(20);
     drive_motor.period_ms(20);
 }
-void Init_communication()
-{
-    COMMUNICATION pan_a(TX_PAN_A, RX_PAN_A,115200,1000,1000); // tx, rx
-    COMMUNICATION pan_b(TX_PAN_B, RX_PAN_B,115200,1000,100); // tx, rx
-
-}
 
 void setControl()
 {
@@ -53,12 +47,39 @@
 
 
 
-
-
 int main()
 {
-    Init_communication();
+    myled=0;
+    //Init communication serial 2chanal
+    COMMUNICATION pan_a(TX_PAN_A, RX_PAN_A,115200,1000,1000); // tx, rx
+    COMMUNICATION pan_b(TX_PAN_B, RX_PAN_B,115200,1000,100); // tx, rx
+
     Init_servo();
+    
+        ANDANTE_PROTOCOL_PACKET packet;
 
-    //pan_a.CommunicatePacket
+        packet.robotId = 0xBB;
+        packet.length = 8;
+        packet.instructionErrorId = 0x01;
+        packet.parameter[0] = 0x02;
+        packet.parameter[1] = 0x03;
+        packet.parameter[2] = 0x04;
+        packet.parameter[3] = 0x05;
+        packet.parameter[4] = 0x06;
+        packet.parameter[5] = 0x07;
+
+        pan_a.sendCommunicatePacket(&packet);
+     
+    while(1) {
+        //      if(pan_a->readable() !=0) {
+
+        uint8_t status = pan_a.receiveCommunicatePacket(&packet);
+
+        if(status == ANDANTE_ERRBIT_NONE) {
+            myled =1;
+            wait(1);
+            myled=0;
+        }
+
+    }
 }