Note: didn't work for me, pi already user of spi (in my case) so still had /dev/mem access denied.joan wrote:....
The "proper" usage (rather than using sudo) is to add yourself to the i2c group, e.g. if your user name is pi then
sudo adduser pi i2c
will allow you to use the i2c devices without needing sudo.
Note, changes in user permissions don't take effect until you log out and back in.
What does work (from another post)
Code: Select all
cd to the directory your file is in then type:- sudo chown root your_program_name sudo chmod 4755 your_program_name You won't need sudo but you still need ./your_program_name