mirror of https://github.com/joan2937/pigpio
98 lines
1.6 KiB
Plaintext
98 lines
1.6 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:
|
|
the library (libpigpio.a) in /usr/local/lib
|
|
the header file (pigpio.h) in /usr/local/include
|
|
the daemon (pigpiod) in /usr/local/bin
|
|
the socket interface (pigs) in /usr/local/bin
|
|
the utility pig2vcd in /usr/local/bin
|
|
the Python module pigpio.py
|
|
|
|
TEST
|
|
|
|
To test the library do
|
|
|
|
sudo ./checklib
|
|
|
|
checklib.c, demolib.c, pig2vcd.c, pigpiod.c, pigs.c, and pigpio.py
|
|
show examples of interfacing with the library.
|
|
|
|
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 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
|
|
|
|
By default 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.
|
|
|
|
If the pigpiod daemon is running you can test the Python
|
|
module by entering the following commands.
|
|
|
|
python
|
|
|
|
import pigpio
|
|
|
|
pigpio.start()
|
|
|
|
print(pigpio.get_current_tick())
|
|
|
|
print(hex(pigpio.read_bank_1()))
|
|
|
|
pigpio.stop()
|
|
|
|
help(pigpio)
|
|
|
|
quit()
|
|
|
|
STOP DAEMON
|
|
|
|
To stop the pigpiod daemon
|
|
|
|
sudo killall pigpiod
|
|
|