could you please help me about an issue I have?
I'd need to move a stepper motor simply through a push button, using an F401RE and the expansion board X-NUCLEO-IHM02A1
but it doesn't work and I don't know why ...
![Sad :-(](./images/smilies/icon_e_sad.gif)
The code I'm using is coming from the official demo present in the stm32duino and it seems all ok (for me) but motor doesn't work
![Sad :-(](./images/smilies/icon_e_sad.gif)
Code: Select all
void setup()
{
/*----- Initialization. -----*/
/* Initializing SPI bus. */
dev_spi = new SPIClass(D11, D12, D3);
SerialPort.begin(115200);
/* Initializing Motor Control Expansion Board. */
x_nucleo_ihm02a1 = new XNucleoIHM02A1(&L6470_init[0], &L6470_init[1], A4, A5, D4, A2, dev_spi);
/* Building a list of motor control components. */
motors = x_nucleo_ihm02a1->get_components();
// init manual motor
pinMode(UP_PIN, INPUT); //Set buzzerPin as output
SerialPort.println("Start demo ...");
}
void loop() {
L6470_init[0].step_sel = StepperMotor::STEP_MODE_FULL;
if (!motors[0]->set_step_mode((StepperMotor::step_mode_t) L6470_init[0].step_sel)) {
SerialPort.print(" Step Mode not allowed.\r\n");
}
// manual motor move
buttonUpState = digitalRead(UP_PIN);
if (buttonUpState==HIGH) {
motors[0]->prepare_run(StepperMotor::FWD,400);
SerialPort.println(" --->>> move!");
} else {
//stop
for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
motors[m]->prepare_soft_hiz();
}
}
x_nucleo_ihm02a1->perform_prepared_actions();
}
Where is the error?:-(
I'm wasting a lot of time on this thing and I don't understand why it doesn't work
![Sad :-(](./images/smilies/icon_e_sad.gif)
Thanks and bye
Lorenzo
Many thanks for your help !!!!!! really thanks!