TP_presa

Dependencies:   SRF08 Servo mbed

Revision:
6:d61052f4ab1e
Parent:
5:8c2101d3ecef
Child:
7:7d3c6326cbc3
--- a/main.cpp	Wed May 31 18:38:08 2017 +0000
+++ b/main.cpp	Mon Jun 26 06:36:03 2017 +0000
@@ -1,17 +1,55 @@
 #include "mbed.h"
-#include "VOITURE.h"
+#include "CAR.h"
 #include "SRF08.h"
 
+Serial bth(p13,p14);
+SRF08 capteur_US(p28,p27,0x0E);
+CAR robot(p9,p10);
+//CAR robot;
 
-SRF08 capteur_US(p28,p27,ADR_US)
-VOITURE robot;
-int main(void){
-   //S2=0;
- while(1){
-       //batterie();
-       //wait (1);
-    robot.Led(0,1,0,0);
-    robot.sbt.putc(Adress);
-       }
-   
-}
+void act(char action) {
+            switch(action) {
+                case 'a':
+                    bth.printf("avancer\n\r");
+                    robot.avancer(70);
+                    break;
+                case 's':
+                    bth.printf("stop\n\r");
+                    robot.arreter();
+                    break;
+                case 'u':
+                    bth.printf("arret\n\r");
+                    robot.arreter();
+                    break;
+                case 'r':
+                    bth.printf("reculer\n\r");
+                    robot.reculer(70);
+                    break;
+                case 'd':
+                    bth.printf("droite\n\r");
+                    robot.tourner_droite(70);
+                    break;
+                case 'g':
+                    bth.printf("gauche\n\r");
+                    robot.tourner_gauche(70);
+                    break;
+                case 'h':
+                    bth.printf("demi tour horaire\n\r");
+                    robot.demi_tour_droite(100);
+                    break;
+                case'l':
+                    bth.printf("demi tour left\n\r");
+                    robot.demi_tour_gauche(100);
+                    break;
+            }
+            action='0';
+        }
+int main(void)
+{
+    //S2=0;
+  //  CAR(p9,p10);
+    
+    while(1) {
+      
+    }
+}