Read push button state | Cypress Semiconductor
Read push button state
I'm very new to system-on-chip programming and I'm trying to read the state of a push button through a digital input pin. I have read the datasheet related to the pin configuration, but it doesn't seem to be enough for my problem. I also have looked for different example projects, but many don't run on my board (CY8CKIT-050 5LP), so it's pretty difficult for me to understand.
In debug mode I use the API function SW2_Read() to get the state (SW2 is the pin's name, assigned to P6), but it always returns 0 either if I push the button or not. Any suggestions?