2023-08-26 11:56 AM
Hi there.
I'm trying to read a button status using STM32F103C6 (fake BluePill) with STM32CubeIDE 1.13.1 and/or using Labcenter Proteus to simulate. However, the reading does not work correctly. I would like some help to understand what is missing.
My poor code:
Thanks in advance.
Solved! Go to Solution.
2023-08-26 05:16 PM
After trying for a long time, I got a solution out of nowhere...
Now it's only working in the real hardware (probably Proteus is not simulating correctly). The code is basically the same.
Thanks for help me!
2023-08-26 12:24 PM
Your code is fine, and there's no bug in HAL_GPIO_ReadPin.
Recheck your connections. Remove the button and jump PA1 directly to GND to verify that works.
Toggle the LED separately to verify that it works.
2023-08-26 04:05 PM - edited 2023-08-26 04:06 PM
Hi TDK...
"Toggle the LED separately to verify that it works."
It was the first item that I did, the toggle the LED separately is worked fine!
"Recheck your connections. Remove the button and jump PA1 directly to GND to verify that works."
It was the second item that I did, before open this topic.
I even changed to the multiple pins ofs buttons, PA0,PA1, PA2,PA3,PA4,PA5,PA6,PA7,PB1... same issue.
Thanks.
2023-08-26 05:09 PM
Okay, good. If both of those tests worked, that would indicate the problem is with your button or button wiring.
2023-08-26 05:16 PM
After trying for a long time, I got a solution out of nowhere...
Now it's only working in the real hardware (probably Proteus is not simulating correctly). The code is basically the same.
Thanks for help me!
2023-08-26 05:18 PM
The wire and button is ok! Checked twice.