forked from joan2937/pigpio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
173 lines (112 loc) · 4.28 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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.
INSTALL
Extract the archive to a directory.
IN THAT DIRECTORY
Enter the following two commands (in this order)
make
sudo make install
This will install
o the library (libpigpio.so) in /usr/local/lib
o the library (libpigpiod_if.so) in /usr/local/lib
o the library (libpigpiod_if2.so) 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 header file (pigpiod_if2.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 man pages in /usr/local/man/man1 and /usr/local/man/man3
o the Python module pigpio.py for Python 2 and 3
TEST (optional)
*** WARNING ************************************************
* *
* All the tests make extensive use of gpio 4 (pin P1/J8-7).*
* Ensure that either nothing or just a LED is connected to *
* gpio 4 before running any of the tests. *
* *
* 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. *
************************************************************
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_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
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, 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.
DAEMON
To launch the daemon do
sudo pigpiod (pigpiod -? for options)
Once the daemon is launched the socket and pipe 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).
PIPE INTERFACE
The pipe interface accepts commands written to /dev/pigpio.
Results are read from /dev/pigout.
Errors are output on /dev/pigerr.
To test the pipe 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
for Python 2 and Python 3.
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)
o the C socket I/F using libpigpiod_if2 (header file pigpiod_if2.h)
On a Linux machine
make -f MakeRemote clean
make -f MakeRemote
make -f MakeRemote install
This will install
o the library (libpigpiod_if.so) in /usr/local/lib
o the library (libpigpiod_if2.so) 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 header file (pigpiod_if2.h) in /usr/local/include
o the socket interface (pigs) in /usr/local/bin
o man pages in /usr/local/man/man1 and /usr/local/man/man3
o the Python module pigpio.py
On Windows machines (and possibly Macs)
The Python module should install with
python setup.py install
pigs, pigpiod_if, and pigpiod_if2 will need minor mods to
reflect the Windows/Mac socket interface.
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
man pigpiod_if2
pydoc pigpio