The ON/OFF button
Configuration
char user_button = 0; /* user button status */void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == B1_Pin) {
// blue button pressed
if (user_button) {
user_button = 0;
// turn off LED
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
} else {
user_button = 1;
// turn on LED
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
}
}
}Benchmarking
Solution
Last updated
Was this helpful?