pigpio/README

139 lines
2.7 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
o the Python module pigpio.py
2013-12-12 11:27:22 +01:00
TEST
To test the library do
sudo ./checklib
2014-01-12 22:31:59 +01:00
EXAMPLE CODE
checklib.c, pig2vcd.c, and pigpiod.c
show examples of interfacing with the pigpio library.
2014-01-21 20:04:59 +01:00
pigs.c and pigpio.py show examples of interfacing with the pigpiod 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
2014-01-12 22:31:59 +01:00
If the pigpiod daemon is running you can test the Python module
by entering the following commands.
2013-12-12 11:32:49 +01:00
python
import pigpio
pigpio.start()
print(pigpio.get_current_tick())
print(hex(pigpio.read_bank_1()))
pigpio.stop()
help(pigpio)
quit()
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
can access 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.