Once you have started the pigpiod service on a Raspberry Pi (covered in Chapter 1, Setting Up Your Development Environment), there are two ways to make your code remote, and by remote, I mean that your program code can be running on any computer (not just a Raspberry Pi) and control a remote Raspberry Pi's GPIOs.
Method 1: This method involves passing the remote Raspberry Pi's IP or host address to the PiGPIO constructor. Using this approach, you can also interface with multiple Raspberry Pi GPIOs by just creating additional instances of pigpio.pi(). For instance, in the following example, any methods called on the pi instance will be executed on the 192.168.0.4 host that has the pigpiod service running:
# Python Code.
pi = pigpio.pi('192.168.0.4', 8888) # Remote host and port (8888 is default if omitted)
Method 2: A second method involves setting an environment variable on the computer and running your Python...