User button use
How to use in main.c the user button of B-G431B-ESC1 board ?
I want to togle the position each time I press (amd release) the button.
Waiting for target position completed and than I can press the button again.
I have selected the PC10 pin in MXCube that originate this code in main.c:
/*Configure GPIO pin : PC10 */
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
in main I write this code, but nothing happen.
Where is the problem ?
if ( GPIO_PIN_10 == 0 )
{
while (GPIO_PIN_10 == 0)
{
}
Pos = MC_GetCurrentPosition1();
if ( Pos == 0.0 )
Pos = 314.159;
else
Pos = 0.0;
MC_ProgramPositionCommandMotor1(Pos,1.5);
while ( MC_GetCurrentPosition1() != Pos )
{
}
}

