Example of Program for the MonsterMoto Shield on the ST Nucleo L152RE
Fork of NucleoF401_MonsterMotoShield by
Revision 2:7f9d0d59c7f5, committed 2015-02-07
- Comitter:
- Michel_Vivien
- Date:
- Sat Feb 07 19:38:19 2015 +0000
- Parent:
- 1:ec9cd1ae6f86
- Commit message:
- Adaptation du code
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 05 16:57:02 2015 +0000 +++ b/main.cpp Sat Feb 07 19:38:19 2015 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" /* - Example of Program for the MonsterMoto Shield on the ST Nucleo F401RE - Code by : Didier Donsez + Example of Program for the MonsterMoto Shield on the ST Nucleo L152RE + Code by : Vivien Michel Based on the Arduino sketch example coded by: Jim Lindblom, SparkFun Electronics @@ -92,11 +92,6 @@ if (direct <=4) { if (direct <=1) - dirA.write(HIGH); - else - dirA.write(LOW); - - if ((direct==0)||(direct==2)) dirB.write(HIGH); else dirB.write(LOW); @@ -111,14 +106,9 @@ { if (direct <=1) dirA.write(HIGH); - else + else dirA.write(LOW); - - if ((direct==0)||(direct==2)) - dirB.write(HIGH); - else - dirB.write(LOW); - + pwmRightpin.write(percent); } } @@ -133,22 +123,22 @@ { goLeftMotor(CW, MAXSPEED); goRightMotor(CCW, MAXSPEED); - checkShield(); + //checkShield(); wait_ms(5000); stopLeftMotor(); stopRightMotor(); - checkShield(); + //checkShield(); wait_ms(2000); - goLeftMotor(CCW, MAXSPEED); - goRightMotor(CW, MAXSPEED); - checkShield(); - wait_ms(5000); + goLeftMotor(CCW, 255.0f); + goRightMotor(CW, 255.0f); + //checkShield(); + wait_ms(3000); stopLeftMotor(); stopRightMotor(); - checkShield(); + //checkShield(); wait_ms(2000); }