![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
asdf
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); } }