Asking the other day this question I discovered a new fascinating world, the gpio zero library.
My first code was this (an example to blink a led):
from gpiozero import LED
from time import sleep
red = LED(21)
while True:
red.on()
sleep(1)
red.off()
sleep(1)
It works when I run it on my raspberry.
But the purpose to learn to work with this new library is to control my gpios remotely from my laptop. And to do this, they explain it here.
But I don't understand how to do it, because they said here that I only have to write this on my laptop (windows, pycharm) program:
PIGPIO_ADDR=192.168.1.3 python3 led.py
When I run it, appears the error:
SyntaxError: invalid syntax
It's obviously I am missing things, and I'm sure it's easy but I really don't know what can I try, and I don't find to much info.
(I don't know if it is important but my code led.py is /home/pi
)
PIGPIO_ADDR=192.168.1.3
and that's outside of Python. Alternatively, don't use environment variables and just do one of the code examples in my #3. – ben_nuttall Jun 16 '19 at 19:52