pigpio/README

154 lines
3.4 KiB
Plaintext
Raw Normal View History

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
make install
2014-01-12 22:31:59 +01:00
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
2014-08-01 10:30:25 +02:00
o man pages in /usr/local/man/man1 and man3
2014-01-12 22:31:59 +01:00
o the Python module pigpio.py
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 ************************************************
* *
2014-08-01 10:30:25 +02:00
* All the tests make extensive use of gpio 4 (pin P1/J8-7).*
2014-04-19 13:19:29 +02:00
* Ensure that either nothing or just a LED is connected to *
* gpio 4 before running any of the tests. *
************************************************************
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
./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
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
2014-03-13 16:50:23 +01:00
pigs.c, pigpio.py, x_pigpiod_if.c, x_pigpio.py, x_pigs, and x_pipe
2014-04-19 13:19:29 +02:00
show examples of interfacing with the pigpio daemon.
2013-12-12 11:27:22 +01:00
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
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).
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
2013-12-12 11:35:55 +01:00
PYTHON MODULE
2014-01-12 22:31:59 +01:00
The Python pigpio module is installed to the default python location.
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)
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
2014-08-01 10:30:25 +02:00
o man pages in /usr/local/man/man1 and 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
pigs and pigpiod_if.c will need minor mods to reflect the
Window's/Mac's socket interface.
2014-08-01 10:30:25 +02:00
DOCUMENTATION
The most up to date should be http://abyz.co.uk/rpi/pigpio/
On the Pi try
man pigs
man pigpiod
man pig2vcd
man pigpio
man pigpiod_if
pydoc pigpio