a demo to control the movement of motor, MotorDriver library and softPWM library are both in need.
Dependencies: MotorDriver SoftwarePWM mbed
Fork of Seeed_Motor_Shield_HelloWorld by
Revision 1:870d6a20e9d6, committed 2014-02-16
- Comitter:
- lawliet
- Date:
- Sun Feb 16 03:44:55 2014 +0000
- Parent:
- 0:7f7b6c3cf00f
- Commit message:
- version 0.1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Feb 12 03:10:21 2014 +0000 +++ b/main.cpp Sun Feb 16 03:44:55 2014 +0000 @@ -23,30 +23,28 @@ #include "mbed.h" #include "MotorDriver.h" -//#define SEEEDUINO_ARCH -#define SEEEDUINO_ARCH_PRO /******Pins definitions*************/ -#if defined(SEEEDUINO_ARCH) -#define MOTORSHIELD_IN1 P1_26 -#define MOTORSHIELD_IN2 P1_29 -#define MOTORSHIELD_IN3 P0_8 -#define MOTORSHIELD_IN4 P0_9 -#define SPEEDPIN_A P1_27 -#define SPEEDPIN_B P0_2 -#elif defined(SEEEDUINO_ARCH_PRO) -#define MOTORSHIELD_IN1 P0_0 -#define MOTORSHIELD_IN2 P0_9 -#define MOTORSHIELD_IN3 P0_8 -#define MOTORSHIELD_IN4 P0_7 -#define SPEEDPIN_A P0_1 -#define SPEEDPIN_B P0_6 -#else -#define MOTORSHIELD_IN1 8 -#define MOTORSHIELD_IN2 11 -#define MOTORSHIELD_IN3 12 -#define MOTORSHIELD_IN4 13 -#define SPEEDPIN_A 9 -#define SPEEDPIN_B 10 +#if defined(TARGET_LPC11U24) //SEEEDUINO_ARCH + #define MOTORSHIELD_IN1 P1_26 + #define MOTORSHIELD_IN2 P1_29 + #define MOTORSHIELD_IN3 P0_8 + #define MOTORSHIELD_IN4 P0_9 + #define SPEEDPIN_A P1_27 + #define SPEEDPIN_B P0_2 +#elif defined(TARGET_LPC1768) //SEEEDUINO_ARCH_PRO + #define MOTORSHIELD_IN1 P0_0 + #define MOTORSHIELD_IN2 P0_9 + #define MOTORSHIELD_IN3 P0_8 + #define MOTORSHIELD_IN4 P0_7 + #define SPEEDPIN_A P0_1 + #define SPEEDPIN_B P0_6 +#else //please redefine the follow pins. + #define MOTORSHIELD_IN1 + #define MOTORSHIELD_IN2 + #define MOTORSHIELD_IN3 + #define MOTORSHIELD_IN4 + #define SPEEDPIN_A + #define SPEEDPIN_B #endif MotorDriver motorDriver(MOTORSHIELD_IN1,MOTORSHIELD_IN2,MOTORSHIELD_IN3,MOTORSHIELD_IN4,SPEEDPIN_A,SPEEDPIN_B);