I am using an NPM package called onoff. It seems to be able to read and write properly on some pins like pin 7, 8, and 9 when I change it programatically, but seems to crash the ROCK 5C when writing to pin 3. Also when reading from pin 7, when i touch the GPIO with 3v3, it seems to not toggle between HIGH and LOW. Any ideas on how to make this work?
Rock5C GPIOs confusion
i got the solution already… Seems that I was reading the documentation for Rock5B and calculating the pin number through the formula given there instead of the rock5c’s. I think the rock5c docs on gpios are only available in chinese. Helpful nonetheless
Though I am still experiencing a problem. I am using sysfs to interact with the gpio pins. I need it to not require root access. How do I do that? I tried using udev rules to set the permissions of /sys/class/gpio and /dev/gpiochip* but seems like that only give access to normal users the ability to export but not edit values and direction still.
Please try to run gpasswd -a username gpio
, and reboot. The /dev/gpiochip*
group is gpio
:
rock@rock-5b:~$ ls /dev/gpiochip* -l
crw-rw---- 1 root gpio 254, 0 Jun 16 09:44 /dev/gpiochip0
crw-rw---- 1 root gpio 254, 1 Jun 16 09:44 /dev/gpiochip1
crw-rw---- 1 root gpio 254, 2 Jun 16 09:44 /dev/gpiochip2
crw-rw---- 1 root gpio 254, 3 Jun 16 09:44 /dev/gpiochip3
crw-rw---- 1 root gpio 254, 4 Jun 16 09:44 /dev/gpiochip4
crw-rw---- 1 root gpio 254, 5 Jun 16 09:44 /dev/gpiochip5
rock@rock-5b:~$
And then use GPIOD, it can don’t use root.
You can switch languages via the 文A
button in the upper right corner of the document station.