Skip to main content
MLöfg.1
Visitor II
October 19, 2022
Question

How do I check if an I/O pin is high or low (state of the pin)? When I toggle pins I want to know what variable to check.

  • October 19, 2022
  • 2 replies
  • 4707 views

Nucleo board:

STM32F042K6T6

This topic has been closed for replies.

2 replies

Javier1
Principal
October 19, 2022

have a look at this AN4899

0693W00000UoKmjQAF.png 

Is your pin defined as gpio?

hit me up in https://www.linkedin.com/in/javiermuñoz/
itsrabbit
Associate
October 21, 2022

You can put a debug point after you toggle your pins, after it stops on debug point; you can see pin status from "Special Function Registers (SFRs)" screen. You can open that tab from Window-> Show View -> SFRs.

In SFRs screen you can check the Input Data Register (IDR) or Output Data Register (ORD) and verify that you're doing it right.

Best regards,

AC