The code below in PyCharm only works if the PC and Raspberry Pi are on the same network. If I want the Raspberry Pi to be on a different network, what changes should I make to the code for that to work?
from gpiozero import LED, Button
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep
factory=PiGPIOFactory(host='192.168.182.240')
GPIO17=LED(17,pin_factory=factory)
After network changed, try to
ping
the new IP address of Piping
test passed, replacehost='192.168.182.240'
with the new IP.