2019NHK_teamA / Mbed 2 deprecated 2019KoRobo

Dependencies:   mbed

Revision:
0:bba4760cb391
Child:
1:72b8490a4ece
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 05 09:18:07 2019 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "Help.h"
+
+Serial pc(USBTX,USBRX);
+DigitalOut POWER_LED(D5);
+
+int direct,speed;
+int Raxis[2],Laxis[2];
+char Rfmot,Lfmot;
+char Rbmot,Lbmot;
+char mot1,air1;
+
+int main(void)
+{
+    speed = fast;
+    direct = sb;
+    format_data(&Rfmot);
+    format_data(&Lfmot);
+    format_data(&Rbmot);
+    format_data(&Lbmot);
+    format_data(&mot1);
+    format_data(&air1);
+    POWER_LED = 1;
+    while(1) {
+        get_stick(Raxis,'R');
+        get_stick(Laxis,'L');
+        speed = set_speed(speed);
+        direct = set_direct(Raxis, Laxis);
+
+        set_emg();
+        if(direct != 0) {
+            set_tire(&Rfmot, &Rbmot, direct, 'R', speed);
+            set_tire(&Lfmot, &Lbmot, direct, 'L', speed);
+        } else {
+            set_slide(&Rfmot,&Lfmot,&Rbmot,&Lbmot,r1,l1, speed);
+        }
+        write_data(Rfmotadd,Rfmot);
+        write_data(Lfmotadd,Lfmot);
+        write_data(Rbmotadd,Rbmot);
+        write_data(Lbmotadd,Lbmot);
+        write_data(Lbmotadd,Lbmot);
+
+
+        pri("\033[2J\033[1;1H RX:%d",Raxis[0]);
+        pri("\033[2;1H RY:%d",Raxis[1]);
+        pri("\033[3;1H LX:%d",Laxis[0]);
+        pri("\033[4;1H LY:%d",Laxis[1]);
+        pri("\033[5;1H Rfmot:0x%x",Rfmot);
+        pri("\033[6;1H Lfmot:0x%x",Lfmot);
+        pri("\033[7;1H Rbmot:0x%x",Rbmot);
+        pri("\033[8;1H Lbmot:0x%x",Lbmot);
+        pri("\033[9;1H direct:%d",direct);
+        pri("\033[10;1H speed:%d",speed);
+    }
+}
\ No newline at end of file