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:
- 0:efeca84ca0a5
- Child:
- 1:14cd9d276832
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Nov 18 13:40:34 2019 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+
+DigitalIn BT(BUTTON1);
+//DigitalOut led(LED1);
+
+DigitalOut IN1_MOTOR1(D13);
+DigitalOut IN2_MOTOR1(D12);
+DigitalOut EN_MOTOR1(D11);
+
+DigitalOut IN1_MOTOR2(D8);
+DigitalOut IN2_MOTOR2(D10);
+DigitalOut EN_MOTOR2(D9);
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+
+int main()
+{
+ pc.printf("Iniciando...\n\r");
+ IN1_MOTOR1 = 0;
+ IN2_MOTOR1 = 0;
+ IN1_MOTOR2 = 0;
+ IN2_MOTOR2 = 0;
+
+ EN_MOTOR1 = 1;
+ EN_MOTOR2 = 1;
+
+ wait_ms(2000);
+
+ while(1)
+ {
+ pc.printf("CW\n\r");
+ IN1_MOTOR1 = 0;
+ IN2_MOTOR1 = 1;
+ IN1_MOTOR2 = 0;
+ IN2_MOTOR2 = 1;
+ wait_ms(4000);
+
+ IN1_MOTOR1 = 0;
+ IN2_MOTOR1 = 0;
+ IN1_MOTOR2 = 0;
+ IN2_MOTOR2 = 0;
+ wait_ms(500);
+
+ pc.printf("CCW\n\r");
+ IN1_MOTOR1 = 1;
+ IN2_MOTOR1 = 0;
+ IN1_MOTOR2 = 1;
+ IN2_MOTOR2 = 0;
+ wait_ms(4000);
+
+ IN1_MOTOR1 = 0;
+ IN2_MOTOR1 = 0;
+ IN1_MOTOR2 = 0;
+ IN2_MOTOR2 = 0;
+ wait_ms(500);
+ }
+}