This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What is the purpose of defining a port when working with GPIO? And how do you properly do it.

Hello!

I have been working through examples lately trying to get the GPIO and PWM to work. But one issue I keep coming up to is how to define pins as input or output, and how to use GPIO pins in general. I see in all the examples they use nodes and define ports and stuff, but honestly I don't understand what this is and why you do it.

Suppose I just want a button on a breadboard as input, then make a led light on the same breadboard light up when it's pressed. Do I have to make two devices and use that as parameter when defining the gpio_pin_configure? And what would the flag be?

Also, what is the flag parameter.

In all older tutorials and examples I notice this wasn't a thing, and it makes it really difficult to follow and learn.

Thanks in advance.

Related