bigtreetech / BTT-Pi

120 stars 20 forks source link

Accessing GPIO Pins via Python #32

Closed tpfirman closed 4 weeks ago

tpfirman commented 4 weeks ago

Hi, I have bought several BTGT Pi v.12 devices. I am using 2 of them as host machines for CNC/Klipper and they are great.

However, I now have a maker project outside of CNC/3d Printing that I would like to use one for, but I need to access the GPIO pins via Python. Specifically, I need to output on 3 pins, and read from at least two.

I can't seem to find how this is done. Can you please let me know the basics of how I can read/write from/to the GPIO pins using python?

bigtreetech commented 4 weeks ago

https://pypi.org/project/gpiod/

https://www.klipper3d.org/RPi_microcontroller.html#optional-identify-the-correct-gpiochip <-- From the klipper wiki but still useful in identifying the gpio.