Raspberry Pi New User Cannot Access GPIO

wiringPiSetup: Unable to open /dev/mem or /dev/gpiomem: Permission denied.
Aborting your program because if it can not access the GPIO
hardware then it most certianly won’t work
Try running with sudo?

sudo usermod -a -G gpio user_name 
% change the owner and group respectively
sudo chown root.gpio /dev/gpiomem 
sudo chmod g+rw /dev/gpiomem

If the problem is still unsolved, try to deactivate your virtual enviroment if used. Otherwise, try to use

sudo chown root.gpio /dev/mem && sudo chmod g+rw /dev/mem

This both two commands have the same to do with each other.

sudo usermod -a -G target_group user_name
sudo adduser user_name target_group


电子邮件地址不会被公开。 必填项已用*标注