bcm2835_init: Unable to open /dev/mem: Permission denied
The ADC Pi is an Analogue to Digital converter for the Raspberry Pi
22/05/2020
Posted by:
Slofware
When I runn my nodejs program without SUDO i get: bcm2835_init: Unable to open /dev/mem: Permission denied
That's because there is no permission to acces the GPIO, but is there a way to go around that?
Because I'm making a website that runs on a raspberry pi 4 that set's some outputs and counts some inputs.
Maybe I need to set-up the program different ?
That's because there is no permission to acces the GPIO, but is there a way to go around that?
Because I'm making a website that runs on a raspberry pi 4 that set's some outputs and counts some inputs.
Maybe I need to set-up the program different ?
22/05/2020
Posted by:
andrew
Unfortunately, I do not know of a way to access GPIO without using sudo. According to the official documentation for the rpio library we use to access the I2C port in nodejs, it needs the root user to access /dev/mem.
22/05/2020
Posted by:
Slofware
Thanks for the answer, I also had readed that :(
Is there another way to make a basic website (or other GUI) which show's some inputs and outputs?
Is there another way to make a basic website (or other GUI) which show's some inputs and outputs?
22/05/2020
Posted by:
andrew
You could use another programming language such as Python which supports I2C and GPIO access without needing root. To use python and apache together with i2c you need to make www-data a member of the i2c group.
sudo adduser www-data i2c
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.