mirror of https://github.com/joan2937/pigpio
137 lines
3.1 KiB
Plaintext
137 lines
3.1 KiB
Plaintext
INSTALL
|
|
|
|
Extract the archive to a directory.
|
|
|
|
IN THAT DIRECTORY
|
|
|
|
Enter the following two commands (in this order)
|
|
|
|
make
|
|
make install
|
|
|
|
This will install
|
|
|
|
o the library (libpigpio.a) in /usr/local/lib
|
|
o the library (libpigpiod_if.a) in /usr/local/lib
|
|
o the header file (pigpio.h) in /usr/local/include
|
|
o the header file (pigpiod_if.h) in /usr/local/include
|
|
o the daemon (pigpiod) in /usr/local/bin
|
|
o the socket interface (pigs) in /usr/local/bin
|
|
o the utility pig2vcd in /usr/local/bin
|
|
o the Python module pigpio.py
|
|
|
|
TEST (optional)
|
|
|
|
*** WARNING ************************************************
|
|
* *
|
|
* All the tests make extensive use of gpio 4 (pin P1-7). *
|
|
* Ensure that either nothing or just a LED is connected to *
|
|
* gpio 4 before running any of the tests. *
|
|
************************************************************
|
|
|
|
To test the library do
|
|
|
|
sudo ./x_pigpio
|
|
|
|
To test the pigpio daemon do
|
|
|
|
sudo pigpiod
|
|
|
|
./x_pigpiod_if # test the C I/F to the pigpio daemon
|
|
./x_pigpio.py # test the Python I/F to the pigpio daemon
|
|
./x_pigs # test the socket I/F to the pigpio daemon
|
|
./x_pipe # test the pipe I/F to the pigpio daemon
|
|
|
|
EXAMPLE CODE
|
|
|
|
x_pigpio.c, pig2vcd.c, and pigpiod.c show examples of interfacing
|
|
with the pigpio library.
|
|
|
|
pigs.c, pigpio.py, x_pigpiod_if.c, x_pigpio.py, x_pigs, and x_pipe
|
|
show examples of interfacing with the pigpio daemon.
|
|
|
|
DAEMON
|
|
|
|
To launch the daemon do
|
|
|
|
sudo pigpiod (pigpiod -? for options)
|
|
|
|
Once the daemon is launched the socket and fifo interfaces will be
|
|
available.
|
|
|
|
When the library starts it locks
|
|
|
|
/var/run/pigpio.pid
|
|
|
|
The file should be automatically deleted when the library terminates.
|
|
|
|
SOCKET INTERFACE
|
|
|
|
Use pigs for the socket interface (pigs help for help).
|
|
|
|
FIFO INTERFACE
|
|
|
|
The fifo interface accepts commands written to /dev/pigpio.
|
|
|
|
Results are read from /dev/pigout.
|
|
|
|
Errors are output on /dev/pigerr.
|
|
|
|
To test the fifo interface perhaps do
|
|
|
|
cat /dev/pigout &
|
|
cat /dev/pigerr &
|
|
|
|
echo "help" >/dev/pigpio
|
|
|
|
PYTHON MODULE
|
|
|
|
The Python pigpio module is installed to the default python location.
|
|
|
|
You can install it for additional Python versions by
|
|
|
|
pythonx.y setup.py install
|
|
|
|
where x.y is the Python version.
|
|
|
|
STOP DAEMON
|
|
|
|
To stop the pigpiod daemon
|
|
|
|
sudo killall pigpiod
|
|
|
|
RUNNING ON NON Pi's
|
|
|
|
You can access the pigpiod daemon running on the Pi from any machine which
|
|
is connected to it over the network. This access is via the socket interface.
|
|
|
|
In particular this allows you to use the following on non-Pi's.
|
|
|
|
o pigs
|
|
o the pigpio Python module
|
|
o the C socket I/F using libpigpiod_if (header file pigpiod_if.h)
|
|
|
|
On a Linux machine
|
|
|
|
make -f MakeRemote clean
|
|
make -f MakeRemote
|
|
make -f MakeRemote install
|
|
|
|
This will install
|
|
|
|
o the library (libpigpiod_if.a) in /usr/local/lib
|
|
o the header file (pigpio.h) in /usr/local/include
|
|
o the header file (pigpiod_if.h) in /usr/local/include
|
|
o the socket interface (pigs) in /usr/local/bin
|
|
o the Python module pigpio.py
|
|
|
|
On Windows machines (and possibly Macs)
|
|
|
|
The Python module should install with
|
|
|
|
python setup.py install
|
|
|
|
pigs and pigpiod_if.c will need minor mods to reflect the
|
|
Window's/Mac's socket interface.
|
|
|