pepe

Dependencies:   mbed Matrix

Revision:
0:a7324f51348d
Child:
1:2716ea33958b
diff -r 000000000000 -r a7324f51348d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 13 23:04:14 2019 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "Robot.h"
+#include "Communication.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+InterruptIn button(USER_BUTTON);
+
+volatile bool mode=true;
+float x1=40,y1=-40;          // Posição inicial do robo
+float a1=1,b1=-2,c1=4;       // Reta ax + by + c = 0
+float x2=50,y2=50,phi2=pi/2; // Pose arbitrária
+
+void pressed()
+{
+    mode= !mode;
+}
+
+int main()
+{
+    pc.baud(9600);
+    button.fall(&pressed);
+
+    while(1) {
+        if (mode==true) {
+            setSpeeds(0,0);
+
+        } else {
+            setSpeeds(0,0); 
+            
+            motion();
+            wait(1);
+            
+            //to_point(x1,y1);
+            //to_line(a1,b1,c1);
+            to_pos(x2,y2,phi2);
+        }
+    }
+}
\ No newline at end of file