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.
Fork of ArduMotoShield by
Revision 1:b4604cdd9597, committed 2015-12-04
- Comitter:
- NorNick
- Date:
- Fri Dec 04 19:23:37 2015 +0000
- Parent:
- 0:72e45c332025
- Commit message:
- Chang DigitalOut -> BusOut
Changed in this revision
| ArduMotoShield.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 72e45c332025 -r b4604cdd9597 ArduMotoShield.cpp
--- a/ArduMotoShield.cpp Sat Nov 08 15:44:22 2014 +0000
+++ b/ArduMotoShield.cpp Fri Dec 04 19:23:37 2015 +0000
@@ -19,11 +19,9 @@
// depend of the Vin and the max voltage of the motors
float MAXPWM = 0.5f;
-#define LOW 0
-#define HIGH 1
-DigitalOut inApin(D12, LOW); //direction control for motor outputs 1 and 2 is on digital pin 12
-DigitalOut inBpin(D13, LOW); //direction control for motor outputs 3 and 4 is on digital pin 13
+BusOut inApin(D11,D12); //direction control for motor outputs 1 and 2 is on digital pin 12
+BusOut inBpin(D13,D14); //direction control for motor outputs 3 and 4 is on digital pin 13
PwmOut pwmApin(D3); //PWM control for motor outputs 1 and 2 is on digital pin 3
PwmOut pwmBpin(D11); //PWM control for motor outputs 3 and 4 is on digital pin 11
@@ -58,8 +56,8 @@
{
if(!isSetup) setup();
- inApin.write(LOW);
- inBpin.write(LOW);
+ inApin=1;
+ inBpin=1;
pwmApin.write(MAXPWM);
pwmBpin.write(MAXPWM);
printf("Forward\n");
@@ -69,8 +67,8 @@
{
if(!isSetup) setup();
- inApin.write(HIGH);
- inBpin.write(HIGH);
+ inApin=2;
+ inBpin=2;
pwmApin.write(MAXPWM);
pwmBpin.write(MAXPWM);
printf("Backward\n");
@@ -80,8 +78,8 @@
{
if(!isSetup) setup();
- inApin.write(LOW);
- inBpin.write(LOW);
+ inApin=0;
+ inBpin=0;
pwmApin.write(0.0f);
pwmBpin.write(0.0f);
printf("Stop\n");
@@ -91,8 +89,8 @@
{
if(!isSetup) setup();
- inApin.write(HIGH);
- inBpin.write(LOW);
+ inApin=2;
+ inBpin=1;
pwmApin.write(MAXPWM);
pwmBpin.write(MAXPWM);
printf("Right\n");
@@ -102,8 +100,8 @@
{
if(!isSetup) setup();
- inApin.write(LOW);
- inBpin.write(HIGH);
+ inApin=1;
+ inBpin=2;
pwmApin.write(MAXPWM);
pwmBpin.write(MAXPWM);
printf("Left\n");
