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.
main.cpp
- Committer:
- madcowswe
- Date:
- 2013-03-20
- Revision:
- 0:c4ec289ae3a7
File content as of revision 0:c4ec289ae3a7:
#include "mbed.h"
DigitalOut EN(p25);
PwmOut IN1(p21);
PwmOut IN2(p22);
PwmOut IN3(p23);
PwmOut IN4(p24);
//from -1 to 1
void motorpower(float left, float right){
IN1 = right < 0 ? -right : 0;
IN2 = right >= 0 ? right : 0;
IN3 = left >= 0 ? left : 0;
IN4 = left < 0 ? -left : 0;
}
int main() {
motorpower(0, 0);
EN = 1;
while(1) {
wait(1);
motorpower(0.2, 0.2);
wait(1);
motorpower(-0.2, 0.2);
wait(1);
motorpower(0,0);
}
}