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
main.cpp
- Committer:
- Marcelocostanzo
- Date:
- 2019-11-18
- Revision:
- 0:efeca84ca0a5
- Child:
- 1:14cd9d276832
File content as of revision 0:efeca84ca0a5:
#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);
}
}