On 10/11/2020 20:28, Dennis Lee Bieber wrote:
> On Tue, 10 Nov 2020 20:08:09 +0000, RobH declaimed the
> following:
>
>> I ssh'd into my pi zero, then I created the script with : sudo nano
>> script.py then copied some other python script into the new script.py.
>> I then ran sudo python3 script.py from within the directory the said
>> script is in, which is the Downloads directory.
>> Nothing happens, no errors, no leds lit.
>>
> My first question is: WHY use "sudo". Isn't the regular user account a
> member of a group that has access to GPIO?
>
> pi@rpi3bplus-1:~$ groups
> pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio
> i2c spi
>
> My second would be: Show us the CODE AND the commands you are
> performing... Don't just "say" what you did -- cut&paste directly from the
> SSH console into a message.
>
>
>> If I open a terminal window on the pi desktop and run the exact same
>> sudo python3 script.py, it runs and the leds light up
>
> Again -- show us (cut&paste) the exact command sequence being
> performed.
>
> However...
>
> pi@rpi3bplus-1:~/Downloads$ groups
> pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio
> i2c spi
> pi@rpi3bplus-1:~/Downloads$ sudo groups
> root
> pi@rpi3bplus-1:~/Downloads$
>
> ... the root user (sudo) does NOT appear to have access to GPIO, SPI, I2C,
> etc.
>
> Without seeing the script one can not tell if errors are being
> swallowed or just being ignored.
>
>
This is the script:
pi@raspberrypi:~/Downloads $ sudo nano ledstest.py
import board
import neopixel
from time import sleep
pixels = neopixel.NeoPixel(board.D18, 56, brightness =1)
pixels.fill((0, 0, 0))
sleep(2)
pixels.fill((0, 0, 255))
pixels.show()
pi@raspberrypi:~/Downloads $ sudo python3 ledstest.py
pi@raspberrypi:~/Downloads $
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|