Edit GPIO Permission
Create a rule file: /lib/udev/rules.d/60-gpio.rules
1
2KERNEL=="spidev*", GROUP="spi", MODE="0660"
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio; chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio; chown -R root:gpio /sys/devices/platform/soc/*.gpio/gpio && chmod -R 770 /sys/devices/platform/soc/*.gpio/gpio'"Add root user to GPIO group
1
2
3groupadd gpio
usermod -a -G gpio root
reboot
Edit C++ code:
1 |
|
Edit CMakelists.txt
1 | cmake_minimum_required(VERSION 3.10) |
Test your program
1 | mkdir build |