main

Dependencies:   TextLCD mbed PID

Files at this revision

API Documentation at this revision

Comitter:
com3
Date:
Mon Mar 17 06:37:37 2014 +0000
Parent:
4:536cd493a337
Commit message:
main

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
usart.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 536cd493a337 -r 6604ec9044a0 main.cpp
--- a/main.cpp	Mon Mar 17 05:41:07 2014 +0000
+++ b/main.cpp	Mon Mar 17 06:37:37 2014 +0000
@@ -48,6 +48,7 @@
 Timeout liner_R;
 Ticker pidupdata;
 Ticker xbeetx;
+Ticker xbeerx;
 //HMC6352 dcompass(p9,p10);
 
 extern string StringFIN;
@@ -266,8 +267,8 @@
     motor.printf("1F0002F0003F0004F000\r\n");       //モータ停止
     motor.attach(&tx_motor,Serial::TxIrq);          //送信空き割り込み(モータ用)
     sensor.attach(&micon_rx,Serial::RxIrq);         //送信空き割り込み(センサ用)
-    xbee.attach(&xbee_rx,Serial::RxIrq);
-    xbeetx.attach(&xbee_tx,1);
+    xbeerx.attach(&xbee_rx,5);
+    xbeetx.attach(&xbee_tx,5);
     //compassdef = (compass / 10);           //コンパス初期値保存
     //compassdef = (dcompass.sample() / 10);
     pid.setInputLimits(0.0,360.0);
diff -r 536cd493a337 -r 6604ec9044a0 usart.cpp
--- a/usart.cpp	Mon Mar 17 05:41:07 2014 +0000
+++ b/usart.cpp	Mon Mar 17 06:37:37 2014 +0000
@@ -12,6 +12,7 @@
 extern Serial xbee;
 extern Serial sensor;
 extern Serial pc;
+extern DigitalOut myled[4];
 
 extern uint8_t value_ir, ir_num, ir_dis, ball_on;
 extern uint8_t ping[4];
@@ -19,12 +20,18 @@
 extern uint8_t ir_max, ir_num;
 extern int compass;
 
+int count = 0;
 void xbee_tx(){
-    
+    xbee.putc(1);
 }
 
 void xbee_rx(){
-    
+    if(xbee.readable()){
+        count = xbee.getc();
+    } else {
+        count = 0;
+    }
+    //pc.printf("%d\n", count);
 }
 
 void micon_rx(){