Simple program featuring a few API functions usage of the X_NUCLEO_IHM05A1 library.
Dependencies: X-NUCLEO-IHM05A1 mbed
Fork of HelloWorld_IHM05A1 by
This application provides a simple example of usage of the X-NUCLEO-IHM05A1 Bipolar Stepper Motor Control Expansion Board.
It shows how to use a stepper motor connected to the board by:
- Running the motor;
- Monitoring the speed and the motor state;
- Setting/Getting the speed;
- Setting/Getting the step mode;
- Setting/Getting the acceleration and deceleration;
- Moving a defined number of steps or microsteps;
- Setting/Getting the direction;
- Setting/Getting the decay mode.
For the hardware configuration of the expansion board, please refer to the X_NUCLEO_IHM05A1 library web page.
Diff: main.cpp
- Revision:
- 3:a6e155687c6a
- Parent:
- 2:c5f455885df7
- Child:
- 5:bc710d77d801
--- a/main.cpp Fri Apr 29 14:59:26 2016 +0000 +++ b/main.cpp Fri Apr 29 15:58:05 2016 +0000 @@ -48,8 +48,13 @@ /* Definitions ---------------------------------------------------------------*/ #ifdef TARGET_NUCLEO_F334R8 #define VREFA_PWM_PIN D11 +#define VREFB_PWM_PIN D9 +#elif TARGET_NUCLEO_F302R8 +#define VREFA_PWM_PIN D11 +#define VREFB_PWM_PIN D15 /* HW mandatory patch: bridge manually D9 with D15 */ #else #define VREFA_PWM_PIN D3 +#define VREFB_PWM_PIN D9 #endif /* Variables -----------------------------------------------------------------*/ @@ -125,7 +130,7 @@ //----- Initialization /* Initializing Motor Control Component. */ - motor = new L6208(D2, D8, D7, D4, D5, D6, VREFA_PWM_PIN, D9); + motor = new L6208(D2, D8, D7, D4, D5, D6, VREFA_PWM_PIN, VREFB_PWM_PIN); if (motor->Init(&initDeviceParameters) != COMPONENT_OK) exit(EXIT_FAILURE); /* Attaching and enabling an interrupt handler. */