Board: Discovery STM32F4VGxx
Code Generated through: ST Cube MX.
I generated the code with Cube MX.
The GPIO pins are given in the STM Discovery Manual:
http://www.st.com/content/ccc/resource/technical/document/user_manual/70/fe/4a/3f/e7/e1/4f/7d/DM00039084.pdf/files/DM00039084.pdf/jcr:content/translations/en.DM00039084.pdf
These are the config thing for clock:
Next is the code that you can put in the while loop to get GPIO toggleon Push button:
if ( HAL_GPIO_ReadPin( GPIOA, GPIO_PIN_0 ) == GPIO_PIN_SET )
{
HAL_GPIO_WritePin( GPIOD, GPIO_PIN_14, GPIO_PIN_SET );
}
else
{
HAL_GPIO_WritePin( GPIOD, GPIO_PIN_14, GPIO_PIN_RESET );
}
Now compile and download the code.
Done..
No comments:
Post a Comment