Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:d95040ff04e6
- Parent:
- 1:fe4f6f2d9ca6
--- 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);
}
}