Projet APP5 comm Zumo avec mbed

Dependencies:   mbed PowerControl

Files at this revision

API Documentation at this revision

Comitter:
bouaziz
Date:
Mon Jan 10 23:02:27 2022 +0000
Parent:
2:d5dd5e731d4a
Commit message:
suite programme ajout fonctions

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
zumo.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Jan 10 08:59:56 2022 +0000
+++ b/main.cpp	Mon Jan 10 23:02:27 2022 +0000
@@ -5,7 +5,8 @@
 zumo myzumo;
 Timer t1;
 long v1,v2;
-
+unsigned short i;
+int meandist;
 int main() {
     char v[3];
     Peripheral_PowerDown(LPC1768_PCONP_PCENET|LPC1768_PCONP_PCSPI|LPC1768_PCONP_PCRTC|LPC1768_PCONP_PCI2C2|
@@ -17,22 +18,17 @@
     t1.reset();
     t1.start();
     t1.stop();
-    printf("INIT= %u\r\n",t1.read_us());
+    //printf("INIT= %u\r\n",t1.read_us());
     t1.reset();
+    myled=0;
     
     while(1) {
-        t1.start();
-        myzumo.speed(140,140);     
-        t1.stop();
-        v1=t1.read_us();
-        wait(0.030);
-        t1.reset();
-        t1.start();
+        myzumo.speed(140,140);
+        do{
+            myzumo.read_data_wait(DATA_SENSOR_MEANDIST, (char*)&meandist);
+        }while(meandist<50);
         myzumo.stop();
-        t1.stop();
-        v2=t1.read_us();
-        printf("%u  %u\r\n",v1,v2);
-        wait(.025);
-        
+        myled=1;
+        while(1);
     }
 }
--- a/zumo.lib	Mon Jan 10 08:59:56 2022 +0000
+++ b/zumo.lib	Mon Jan 10 23:02:27 2022 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/Projet_temp_sensors/code/zumo/#1082c5b3b418
+https://os.mbed.com/teams/Projet_temp_sensors/code/zumo/#d9c9ef63c5ff