push button goes to input16 and LED goes output25 install gpiod (copy 2 lines below to terminal)
- sudo apt-get install libgpiod2 libgpiod-dev
- sudo apt install gpiod
- Manually test with lines below. Copy and paste into terminal. check gpio line configuration (copy line below to terminal) gpioinfo
For Raspberry Pi 5 use gpiochip4 (For Raspberry Pi 4 use gpiochip0)
set output 25 high (copy line below to terminal)
gpioset gpiochip4 25=1
set output 25 low (copy line below to terminal)
gpioset gpiochip4 25=0
monitor input 16 state (copy line below to terminal)
gpioset gpiochip4 16
USEFUL LINKS:
Video of IO testing [PART 2 of 2]: https://youtu.be/koUr7oOyUXY Video, IO with GPIOD [PART 1 of 2]: https://youtu.be/cBXBhVYnU5Q
Access gpio with gpiod: https://www.ics.com/blog/gpio-programming-exploring-libgpiod-library
https://lloydrochester.com/post/hardware/libgpiod-blink-led-rpi/
old way sysfs, deprecated https://www.ics.com/blog/gpio-programming-using-sysfs-interface