pigpio/README

175 lines
4.3 KiB
Plaintext
Raw Normal View History

2015-02-25 21:34:52 +01:00
NOTE
The initial part of the make, the compilation of pigpio.c,
takes 100 seconds on early model Pis. Be patient. The overall
install takes just over 3 minutes.
2013-12-12 11:27:22 +01:00
INSTALL
Extract the archive to a directory.
IN THAT DIRECTORY
Enter the following two commands (in this order)
make
2015-11-10 15:57:12 +01:00
sudo make install
2013-12-12 11:27:22 +01:00
2014-01-12 22:31:59 +01:00
This will install
2015-06-18 12:46:46 +02:00
o the library (libpigpio.so) in /usr/local/lib
o the library (libpigpiod_if.so) in /usr/local/lib
2015-11-10 15:57:12 +01:00
o the library (libpigpiod_if2.so) in /usr/local/lib
2014-01-12 22:31:59 +01:00
o the header file (pigpio.h) in /usr/local/include
o the header file (pigpiod_if.h) in /usr/local/include
2015-11-10 15:57:12 +01:00
o the header file (pigpiod_if2.h) in /usr/local/include
o the header file (pigs.h) in /usr/local/include
2014-01-12 22:31:59 +01:00
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
2015-11-10 15:57:12 +01:00
o man pages in /usr/local/man/man1 and /usr/local/man/man3
2015-06-18 12:46:46 +02:00
o the Python module pigpio.py for Python 2 and 3
2013-12-12 11:27:22 +01:00
2014-03-13 16:50:23 +01:00
TEST (optional)
2013-12-12 11:27:22 +01:00
2014-04-19 13:19:29 +02:00
*** WARNING ************************************************
* *
2018-02-08 19:48:33 +01:00
* All the tests make extensive use of gpio 25 (pin 22). *
2014-04-19 13:19:29 +02:00
* Ensure that either nothing or just a LED is connected to *
* gpio 25 before running any of the tests. *
2014-11-20 16:36:16 +01:00
* *
* Some tests are statistical in nature and so may on *
* occasion fail. Repeated failures on the same test or *
* many failures in a group of tests indicate a problem. *
2014-04-19 13:19:29 +02:00
************************************************************
2013-12-12 11:27:22 +01:00
To test the library do
2014-03-13 16:50:23 +01:00
sudo ./x_pigpio
2014-04-19 13:19:29 +02:00
To test the pigpio daemon do
2014-03-13 16:50:23 +01:00
sudo pigpiod
2015-11-10 15:57:12 +01:00
./x_pigpiod_if # test the C I/F to the pigpio daemon
./x_pigpiod_if2 # 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
2013-12-12 11:27:22 +01:00
2014-01-12 22:31:59 +01:00
EXAMPLE CODE
2014-03-13 16:50:23 +01:00
x_pigpio.c, pig2vcd.c, and pigpiod.c show examples of interfacing
with the pigpio library.
2014-01-12 22:31:59 +01:00
2015-11-10 15:57:12 +01:00
pigs.c, pigpio.py, x_pigpiod_if, x_pigpiod_if2.c, x_pigpio.py,
x_pigs, and x_pipe show examples of interfacing with the pigpio
daemon. x_pipe uses the pipe interface, the others use the
socket interface.
2013-12-12 11:27:22 +01:00
DAEMON
To launch the daemon do
sudo pigpiod (pigpiod -? for options)
2014-09-09 23:58:39 +02:00
Once the daemon is launched the socket and pipe interfaces will be
2013-12-12 11:27:22 +01:00
available.
When the library starts it locks
/var/run/pigpio.pid
2014-01-12 22:31:59 +01:00
The file should be automatically deleted when the library terminates.
2013-12-12 11:27:22 +01:00
SOCKET INTERFACE
Use pigs for the socket interface (pigs help for help).
2014-09-09 23:58:39 +02:00
PIPE INTERFACE
2013-12-12 11:27:22 +01:00
2014-09-09 23:58:39 +02:00
The pipe interface accepts commands written to /dev/pigpio.
2013-12-12 11:27:22 +01:00
Results are read from /dev/pigout.
Errors are output on /dev/pigerr.
2014-09-09 23:58:39 +02:00
To test the pipe interface perhaps do
2013-12-12 11:27:22 +01:00
cat /dev/pigout &
cat /dev/pigerr &
echo "help" >/dev/pigpio
2013-12-12 11:35:55 +01:00
PYTHON MODULE
2015-06-18 12:46:46 +02:00
The Python pigpio module is installed to the default Python location
for Python 2 and Python 3.
2014-01-12 22:31:59 +01:00
You can install it for additional Python versions by
2013-12-12 11:35:55 +01:00
pythonx.y setup.py install
where x.y is the Python version.
2013-12-12 11:32:49 +01:00
2013-12-12 11:27:22 +01:00
STOP DAEMON
2013-12-12 11:32:49 +01:00
To stop the pigpiod daemon
2013-12-12 11:27:22 +01:00
sudo killall pigpiod
2014-01-12 22:31:59 +01:00
RUNNING ON NON Pi's
You can access the pigpiod daemon running on the Pi from any machine which
2014-03-13 16:50:23 +01:00
is connected to it over the network. This access is via the socket interface.
2014-01-12 22:31:59 +01:00
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)
2015-11-10 15:57:12 +01:00
o the C socket I/F using libpigpiod_if2 (header file pigpiod_if2.h)
2014-01-12 22:31:59 +01:00
On a Linux machine
make -f MakeRemote clean
make -f MakeRemote
make -f MakeRemote install
This will install
2015-06-18 12:46:46 +02:00
o the library (libpigpiod_if.so) in /usr/local/lib
2015-11-10 15:57:12 +01:00
o the library (libpigpiod_if2.so) in /usr/local/lib
2014-01-12 22:31:59 +01:00
o the header file (pigpio.h) in /usr/local/include
o the header file (pigpiod_if.h) in /usr/local/include
2015-11-10 15:57:12 +01:00
o the header file (pigpiod_if2.h) in /usr/local/include
2014-01-12 22:31:59 +01:00
o the socket interface (pigs) in /usr/local/bin
2015-11-10 15:57:12 +01:00
o man pages in /usr/local/man/man1 and /usr/local/man/man3
2014-01-12 22:31:59 +01:00
o the Python module pigpio.py
On Windows machines (and possibly Macs)
The Python module should install with
python setup.py install
2015-11-10 15:57:12 +01:00
pigs, pigpiod_if, and pigpiod_if2 will need minor mods to
reflect the Windows/Mac socket interface.
2014-01-12 22:31:59 +01:00
2014-08-01 10:30:25 +02:00
DOCUMENTATION
2018-02-08 19:48:33 +01:00
The most up to date should be http://abyz.me.uk/rpi/pigpio/
2014-08-01 10:30:25 +02:00
On the Pi try
man pigs
man pigpiod
man pig2vcd
man pigpio
man pigpiod_if
2015-11-10 15:57:12 +01:00
man pigpiod_if2
2014-08-01 10:30:25 +02:00
pydoc pigpio