Sz_Insper / Mbed 2 deprecated Line_follow

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Marcelocostanzo
Date:
Mon Nov 18 13:38:21 2019 +0000
Parent:
1:fe4f6f2d9ca6
Commit message:
Seguidor de linha funcionando

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Oct 08 13:26:21 2018 +0000
+++ b/main.cpp	Mon Nov 18 13:38:21 2019 +0000
@@ -8,7 +8,7 @@
 */
 
 #include "mbed.h"
-#define corte 2800
+#define corte 0.3f
 
 AnalogIn S0(A3);
 AnalogIn S1(A5);
@@ -18,8 +18,8 @@
 DigitalOut IN2B(PA_1);
 DigitalOut IN1A(PB_4);
 DigitalOut IN2A(PB_5);
-DigitalOut ENA(PA_10);
-DigitalOut ENB(PC_1);
+PwmOut ENA(PA_10);
+PwmOut ENB(PB_3);
 Serial pc(USBTX, USBRX); // tx, rx
 
 
@@ -29,8 +29,8 @@
     float S1_val = 0;
     bool flag = 0;
     
-    ENA = 1;
-    ENB = 1;
+    ENA = 0.12f;
+    ENB = 0.12f;
 
     while(1) 
     {
@@ -39,8 +39,8 @@
         S0_val = S0.read();
         S1_val = S1.read(); 
         
-        S0_val = S0_val * 3300; // Converts value in the 0V-3.3V range
-        S1_val = S1_val * 3300; // Converts value in the 0V-3.3V range
+        //S0_val = S0_val * 3300; // Converts value in the 0V-3.3V range
+        //S1_val = S1_val * 3300; // Converts value in the 0V-3.3V range
         
         // Display values
         //printf("measure S0 = %.0f mV\n", S0_val);
@@ -103,8 +103,8 @@
             {
                 flag = 0;
                 printf("DESACIONADO\n");
-                ENA = 0;
-                ENB = 0;
+                ENA = 0.0f;
+                ENB = 0.0f;
                 wait(0.5);
             }
         }        
--- a/mbed.bld	Mon Oct 08 13:26:21 2018 +0000
+++ b/mbed.bld	Mon Nov 18 13:38:21 2019 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file