mirror of https://github.com/joan2937/pigpio
495 lines
47 KiB
Plaintext
495 lines
47 KiB
Plaintext
|
The following examples show various ways pigpio may be used to communicate with sensors via the GPIO.<br>
|
||
|
<br>
|
||
|
Although many are complete programs they are intended to be a starting point in producing your own code, not an end point.<br>
|
||
|
<br>
|
||
|
<a href="#Index">Index</a><br><br>
|
||
|
<a href="#Hardware">Hardware</a><br><br>
|
||
|
<a href="#Shell code">Shell code</a><br><br>
|
||
|
<a href="#C code">C code</a><br><br>
|
||
|
<a href="#C++ code">C++ code</a><br><br>
|
||
|
<a href="#pigpiod_if2 code">pigpiod_if2 code</a><br><br>
|
||
|
<a href="#Python code">Python code</a><br><br>
|
||
|
<a href="#Miscellaneous related code">Miscellaneous related code</a><br><br>
|
||
|
<a href="#External links">External links</a><br><br>
|
||
|
<h3><span id="Hardware">Hardware</span></h3>
|
||
|
A few practical examples of using pigpio with hardware.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_ir_remote"><a href="ex_ir_remote.html">IR Receiver</a><br>2013-06-09</span></td><td>Reading an infrared remote receiver.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_LDR"><a href="ex_LDR.html">Light Dependent Resistor</a><br>2013-06-09</span></td><td>Measuring brightness with a light dependent resistor (LDR). Improved methods of timing the start of the capacitor recharge are given for <a href="#C_pot_cap_charge_c">C</a> and <a href="#Python_pot_cap_py">Python</a>.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_motor_shield"><a href="ex_motor_shield.html">Motor Shield</a><br>2013-12-15</span></td><td>Using an Arduino motor shield.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_rotary_encoder"><a href="ex_rotary_encoder.html">Rotary Encoder</a><br>2013-06-09</span></td><td>Reading a rotary encoder.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_sonar_ranger"><a href="ex_sonar_ranger.html">Sonar Ranger</a><br>2013-06-10</span></td><td>Measuring range with a sonar ranger.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="Shell code">Shell code</span></h3>
|
||
|
Examples of using pigpio with shell code.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Shell_gpiotest"><a href="code/gpiotest.zip">GPIO test</a><br>2014-08-11</span></td><td>This bash script tests the user GPIO. <a href="http://youtu.be/sCJFLKWaxHo">Video</a><br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="C code">C code</span></h3>
|
||
|
Examples of C pigpio programs.<br>
|
||
|
<br>
|
||
|
If your program is called foobar.c then build with<br>
|
||
|
<br>
|
||
|
gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_1"><a href="code/freq_count_1.zip">Frequency Counter 1</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetAlertFunc">gpioSetAlertFunc</a> function to set a callback for GPIO state changes. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1μs).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_2"><a href="code/freq_count_2.zip">Frequency Counter 2</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a> function to set a callback for accumulated GPIO state changes over the last millisecond. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1μs). Generally the method used is more complicated but more efficient than frequency counter 1.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2014-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results. This C program uses pigpio notifications.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_ir_hasher_c"><a href="code/ir_hasher_c.zip">IR Receiver</a><br>2015-02-25</span></td><td>Function to hash a code from an IR receiver (reading an IR remote control).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>A program to display readings from the (I2C) PCF8591.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_pot_cap_charge_c"><a href="code/pot_cap_charge_c.zip">Pot + Capacitor Recharge Timing</a><br>2014-03-14</span></td><td>Function to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rotary_encoder_c"><a href="code/rotary_encoder_c.zip">Rotary Encoder</a><br>2015-10-03</span></td><td>Function to decode a mechanical rotary encoder.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3008_c"><a href="code/rawMCP3008_c.zip">SPI bit bang MCP3008</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 ADC simultaneously with accurately timed intervals. One 10-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3202_c"><a href="code/rawMCP3202_c.zip">SPI bit bang MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3202 ADC simultaneously with accurately timed intervals. One 12-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3XXX_c"><a href="code/rawMCP3XXX_c.zip">SPI bit bang MCP3008 and MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 and MCP3202 ADC simultaneously with accurately timed intervals. One channel of each ADC may be sampled at up to 25k samples per second. The 10-bit MCP3008 readings are multiplied by 4 so they have the same range (0-4095) as the 12-bit MCP3202.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_servo_demo"><a href="code/servo_demo.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
|
||
|
<br>
|
||
|
sudo ./servo_demo # Generate pulses on GPIO 4.<br>
|
||
|
<br>
|
||
|
sudo ./servo_demo 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_code/spi-pigpio-speed.c"><a href="code/spi-pigpio-speed.c">SPI pigpio driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the pigpio SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_wiegand_c"><a href="code/wiegand_c.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Function to read a Wiegand Reader.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="C++ code">C++ code</span></h3>
|
||
|
Examples of C++ pigpio programs.<br>
|
||
|
<br>
|
||
|
If your program is called foobar.cpp then build with<br>
|
||
|
<br>
|
||
|
g++ -Wall -pthread -o foobar foobar.cpp -lpigpio -lrt<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_ir_hasher_cpp"><a href="code/ir_hasher_cpp.zip">IR Receiver</a><br>2015-02-22</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_rotary_encoder_cpp"><a href="code/rotary_encoder_cpp.zip">Rotary Encoder</a><br>2013-12-30</span></td><td>Class to decode a mechanical rotary encoder.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_wiegand_cpp"><a href="code/wiegand_cpp.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Class to read a Wiegand Reader.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="pigpiod_if2 code">pigpiod_if2 code</span></h3>The pigpiod_if2 code examples are linked with libpigpiod_if2 and are written in C.<br>
|
||
|
<br>
|
||
|
The pigpiod_if2 library may be compiled and run on any Linux machine and allows control of the GPIO on one or more networked Pis.<br>
|
||
|
<br>
|
||
|
It should be possible to adapt the library to run on Macs and PCs.<br>
|
||
|
<br>
|
||
|
Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2__433D"><a href="code/_433D.zip">433MHz Keyfob RX/TX</a><br>2015-11-17</span></td><td>Code to read and transmit 313 and 434 MHz key fob codes. The codes to be read must use Manchester encoding. The transmitted codes use Manchester encoding.<br>
|
||
|
<br>
|
||
|
./_433D -r10 # Print fob keycodes received on GPIO 10.<br>
|
||
|
<br>
|
||
|
./_433D -t5 8246184 # Transmit code on GPIO 5.<br>
|
||
|
<br>
|
||
|
./_433D -r10 -t5 8246184 # Transmit code on GPIO 5 then listen for codes<br>
|
||
|
<br>
|
||
|
./_433D -? for options.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_DHTXXD"><a href="code/DHTXXD.zip">DHT11/21/22/33/44 Sensor</a><br>2016-02-16</span></td><td>Code to read the DHT temperature and humidity sensors. The sensor may be auto detected. A DHT11 sensor may be read once per second. The other sensors should not be read more often than once every three seconds.<br>
|
||
|
<br>
|
||
|
The code auto detects the DHT model and generally only the GPIO needs to be specified.<br>
|
||
|
<br>
|
||
|
./DHTXXD -g17 # Read a DHT connected to GPIO 17.<br>
|
||
|
<br>
|
||
|
./DHTXXD -g5 -i3 # Read a DHT connected to GPIO 5 every three seconds.<br>
|
||
|
<br>
|
||
|
./DHTXXD -? # for options.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_RED"><a href="code/RED.zip">Rotary Encoder</a><br>2015-11-18</span></td><td>Code to monitor a rotary encoder and show the position changes. By default the detent changes are shown. There is an option to show the four steps per detent instead.<br>
|
||
|
<br>
|
||
|
./RED -a7 -b8 -s30 # Show encoder on 7/8 detent changes for 30 seconds.<br>
|
||
|
<br>
|
||
|
./RED -a5 -b6 -m1 # Show encoder on 5/6 step changes forever.<br>
|
||
|
<br>
|
||
|
./RED -? # for options.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_servo_demo_D"><a href="code/servo_demo_D.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
|
||
|
<br>
|
||
|
./servo_demo_D # Generate pulses on GPIO 4.<br>
|
||
|
<br>
|
||
|
./servo_demo_D 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_SRTED"><a href="code/SRTED.zip">Sonar Ranger</a><br>2015-11-16</span></td><td>Code to read the SRF-04 and SRF-05 type of sonar rangers which use the trigger echo method of operation. A 10 μs trigger pulse initiates a series of high frequency sonar chirps. The echo line then goes high and stays high until an echo from an object is received. The echo high time is used to calculate the distance of the object.<br>
|
||
|
<br>
|
||
|
For a one-off reading only the trigger and echo GPIO need to be specified.<br>
|
||
|
<br>
|
||
|
./SRTED -t5 -e6 # Read a sonar ranger connected to GPIO 5/6.<br>
|
||
|
<br>
|
||
|
./SRTED -t11 -e5 -i0.1 # Read a sonar ranger connected to GPIO 11/5 every 0.1 seconds.<br>
|
||
|
<br>
|
||
|
./SRTED -? # for options.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_RED"><a href="code/tx_RED.zip">Transmit Rotary Encoder Test Signals</a><br>2015-11-25</span></td><td>Code to transmit quadrature signals to test rotary encoder software.<br>
|
||
|
<br>
|
||
|
tx_RED -aGPIO -bGPIO [options]<br>
|
||
|
<br>
|
||
|
tx_RED -? for options<br>
|
||
|
<br>
|
||
|
E.g.<br>
|
||
|
<br>
|
||
|
tx_RED -a5 -b6 -s20 -r-100<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_WD"><a href="code/tx_WD.zip">Transmit Wiegand Test Signals</a><br>2015-11-25</span></td><td>Code to transmit Wiegand codes to test Wiegand decoder software.<br>
|
||
|
<br>
|
||
|
tx_WD -gGPIO -wGPIO [options] {code}+<br>
|
||
|
<br>
|
||
|
tx_WD -? for options<br>
|
||
|
<br>
|
||
|
E.g.<br>
|
||
|
<br>
|
||
|
tx_WD -g5 -w6 -s37 12345 67890 123 899999<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_WD"><a href="code/WD.zip">Wiegand Reader</a><br>2015-11-25</span></td><td>Code to read a Wiegand Reader.<br>
|
||
|
<br>
|
||
|
./WD -g7 -w8 -s30 # Read Wiegand codes from GPIO 7/8 for 30 seconds.<br>
|
||
|
<br>
|
||
|
./WD -g5 -w6 # Read Wiegand codes from GPIO 5/6 forever.<br>
|
||
|
<br>
|
||
|
./WD -? # for options.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="Python code">Python code</span></h3>The Python code may be run on any Python machine and allows control of the GPIO on one or more networked Pis.<br>
|
||
|
<br>
|
||
|
The Python machine need not be a Pi, it may run Windows, Mac, Linux, anything as long as it supports Python.<br>
|
||
|
<br>
|
||
|
Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__433_py"><a href="code/_433_py.zip">433MHz Keyfob RX/TX</a><br>2015-10-30</span></td><td>Classes to send and receive 433MHz wireless keyfob codes. These keyfobs are widely used for remote control of devices.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__7_segment"><a href="code/_7_segment.zip">7-Segment LED Display Multiplexing</a><br>2016-12-12</span></td><td>Script to multiplex several 7-segment LED displays. Each display has the segments a-g and the decimal point connected in parallel but has an individual enable GPIO (connected to the common anode or cathode).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_test-APA102_py"><a href="code/test-APA102_py.zip">APA102 LED strip driver</a><br>2017-03-28</span></td><td>Script to drive an APA102 LED strip. Three different methods are demonstrated - using spidev SPI (only works on the local Pi), pigpio SPI, and pigpio waves. The SPI solutions only work with the dedicated SPI GPIO. Waves may use any spare GPIO. Four different examples are given including a LED strip clock.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_BME280_py"><a href="code/BME280_py.zip">BME280 Sensor</a><br>2016-08-05</span></td><td>Class to read the relative humidity, temperature, and pressure from a BME280 sensor. The sensor has both an I2C and a SPI interface which are both<br>
|
||
|
supported by the class.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/DHT.py"><a href="code/DHT.py">DHT11/21/22/33/44 Sensor</a><br>2019-11-07</span></td><td>Class to read the relative humidity and temperature from a DHT sensor. It can automatically recognize the sensor type.<br>
|
||
|
<br>
|
||
|
The default script prints the reading from the specified DHT every 2 seconds. E.g. ./DHT.py 22 27 displays the data for DHT connected to GPIO 22 and 27.<br>
|
||
|
<br>
|
||
|
The following data is printed for each DHT: timestamp, GPIO, status, temperature, and humidity.<br>
|
||
|
<br>
|
||
|
The timestamp is the number of seconds since the epoch (start of 1970).<br>
|
||
|
<br>
|
||
|
The status will be one of: 0 - a good reading, 1 - checksum failure, 2 - data had one or more invalid values, 3 - no response from sensor.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DHT22_py"><a href="code/DHT22_py.zip">DHT22 AM2302 Sensor</a><br>2014-07-11</span></td><td>Class to read the relative humidity and temperature from a DHT22/AM2302 sensor.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DS18B20-1_py"><a href="code/DS18B20-1_py.zip">DS18B20 Temperature Sensor</a><br>2016-06-29</span></td><td>Script to read the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
|
||
|
<br>
|
||
|
To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
|
||
|
<br>
|
||
|
dtoverlay=w1-gpio<br>
|
||
|
<br>
|
||
|
By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
|
||
|
<br>
|
||
|
Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
|
||
|
<br>
|
||
|
This script uses the file features of pigpio to access the remote file system.<br>
|
||
|
<br>
|
||
|
The following entry must be in /opt/pigpio/access.<br>
|
||
|
<br>
|
||
|
/sys/bus/w1/devices/28*/w1_slave r<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PPD42NS_py"><a href="code/PPD42NS_py.zip">Dust Sensor</a><br>2015-11-22</span></td><td>Class to read a Shinyei PPD42NS Dust Sensor, e.g. as used in the Grove dust sensor.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_gpio_status_py"><a href="code/gpio_status_py.zip">GPIO Status</a><br>2014-06-12</span></td><td>Script to display the status of GPIO 0-31.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_HX711_py"><a href="code/HX711_py.zip">HX711 24-bit ADC</a><br>2018-03-05</span></td><td>Class to read the channels of a HX711 24-bit ADC.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ADXL345_py"><a href="code/i2c_ADXL345_py.zip">I2C ADXL345 Accelerometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from an ADXL345 accelerometer.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_HMC5883L_py"><a href="code/i2c_HMC5883L_py.zip">I2C HMC5883L Magnetometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from a HMC5883L Magnetometer (compass).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ITG3205_py"><a href="code/i2c_ITG3205_py.zip">I2C ITG3205 Gyroscope</a><br>2015-04-01</span></td><td>Script to display the X, Y, Z, and temperature values read from an ITG3205 gyroscope.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_lcd_py"><a href="code/i2c_lcd_py.zip">I2C LCD Display</a><br>2016-04-20</span></td><td>Class to display text on a LCD character display. The class supports the PCF8574T 8-bit I2C port expander connected to a HD44780 based LCD display. These displays are commonly available in 16x2 and 20x4 character formats.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bsc_arduino_py"><a href="code/bsc_arduino_py.zip">I2C slave device</a><br>2016-10-31</span></td><td>This script demonstrates how to transfer messages from an Arduino acting as the I2C bus master to the Pi acting as an I2C slave device.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2015-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_sonar_py"><a href="code/i2c_sonar_py.zip">I2C Sonar</a><br>2016-03-24</span></td><td>A class to read up to 8 HC-SR04 sonar rangers connected to an MCP23017 port expander.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_ir_hasher_py"><a href="code/ir_hasher_py.zip">IR Receiver</a><br>2014-06-12</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_irrp_py"><a href="code/irrp_py.zip">IR Record and Playback</a><br>2015-12-21</span></td><td>This script may be used to record and play back arbitrary IR codes.<br>
|
||
|
<br>
|
||
|
To record the GPIO connected to the IR receiver, a file for the recorded codes, and the codes to be recorded are given.<br>
|
||
|
<br>
|
||
|
E.g. ./irrp.py -r -g4 -fir-codes vol+ vol- 1 2 3 4 5 6 7 8 9 0<br>
|
||
|
<br>
|
||
|
To playback the GPIO connected to the IR transmitter, the file containing the recorded codes, and the codes to be played back are given.<br>
|
||
|
<br>
|
||
|
E.g. ./irrp.py -p -g18 -fir-codes 2 3 4<br>
|
||
|
<br>
|
||
|
./irrp.py -h # for options<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_kivy_GPIO_py"><a href="code/kivy_GPIO_py.zip">Kivy GPIO control</a><br>2016-12-11</span></td><td>This example shows how to use Kivy to control a Pi's GPIO. The GPIO may be configured as inputs, outputs, or to generate Servo or PWM pulses. Kivy is an Open source Python library for rapid development of applications.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_MAX6675_py"><a href="code/MAX6675_py.zip">MAX6675 SPI Temperature Sensor</a><br>2016-05-02</span></td><td>A script to read the temperature from a MAX6675 connected to a K-type thermocouple. The MAX6675 supports readings in the range 0 - 1023.75 C. Up to 4 readings may be made per second.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_monitor_py"><a href="code/monitor_py.zip">Monitor GPIO</a><br>2016-09-17</span></td><td>Script to monitor GPIO for level changes. By default all GPIO are monitored. At a level change the GPIO, new level, and microseconds since the last change is printed.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_morse_code_py"><a href="code/morse_code_py.zip">Morse Code</a><br>2015-06-17</span></td><td>Script to transmit the morse code corresponding to a text string.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/NRF24.py"><a href="code/NRF24.py">NRF24 radio transceiver</a><br>2018-01-06</span></td><td>Script to transmit and receive messages using the nRF24L01 radio transceiver.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCA9685_py"><a href="code/PCA9685_py.zip">PCA9685 16 Channel PWM</a><br>2016-01-31</span></td><td>Class to control the 16 PWM channels of the I2C PCA9685. All channels use the same frequency. The duty cycle or pulse width may be set independently for each channel.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>Script to display readings from the (I2C) PCF8591.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM.py"><a href="code/PPM.py">PPM (Pulse Position Modulation) generation</a><br>2016-02-19</span></td><td>Script to generate PPM signals on a chosen GPIO.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM_to_servo.py"><a href="code/PPM_to_servo.py">PPM (Pulse Position Modulation) to servo pulses</a><br>2019-10-09</span></td><td>Script to read a PPM signal on a GPIO and generate the corresponding servo signals on chosen GPIO.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bench_1_py"><a href="code/bench_1_py.zip">pigpio Benchmark</a><br>2014-06-12</span></td><td>Script to benchmark the pigpio Python module's performance.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pigpio_cgi_py"><a href="code/pigpio_cgi_py.zip">pigpio CGI</a><br>2015-05-04</span></td><td>Script demonstrating how to access the pigpio daemon using CGI from a browser. Instructions on how to use with Apache2 on the Pi are given in the comments.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_playback_py"><a href="code/playback_py.zip">Playback piscope recordings</a><br>2016-12-23</span></td><td>Script to playback GPIO data recorded in piscope format.<br>
|
||
|
<br>
|
||
|
To playback GPIO 4 to GPIO 4 from file data.piscope<br>
|
||
|
./playback.py data.piscope 4<br>
|
||
|
<br>
|
||
|
To playback GPIO 4 to GPIO 7 from file rec.txt<br>
|
||
|
./playback.py rec.txt 7=4<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pot_cap_py"><a href="code/pot_cap_py.zip">Pot + Capacitor Recharge Timing</a><br>2016-09-26</span></td><td>Class to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_PWM_py"><a href="code/read_PWM_py.zip">PWM Monitor</a><br>2015-12-08</span></td><td>Class to monitor a PWM signal and calculate the frequency, pulse width, and duty cycle.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_rotary_encoder_py"><a href="code/rotary_encoder_py.zip">Rotary Encoder</a><br>2014-06-12</span></td><td>Class to decode a mechanical rotary encoder.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_RPM_py"><a href="code/read_RPM_py.zip">RPM Monitor</a><br>2016-01-20</span></td><td>Class to monitor speedometer pulses and calculate the RPM (Revolutions Per Minute).<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_Si7021_py"><a href="code/Si7021_py.zip">Si7021 I2C Temperature and Humidity Sensor</a><br>2016-05-07</span></td><td>Class to read the temperature and relative humidity from a Si7021.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_SPI_mon_py"><a href="code/SPI_mon_py.zip">SPI Monitor</a><br>2016-09-21</span></td><td>A program to passively sniff SPI transactions and display the results. The SPI rate should be limited to about 70kbps if using the default pigpio 5µs sampling rate.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_servo_demo_py"><a href="code/servo_demo_py.zip">Servo Pulse Generator</a><br>2016-10-07</span></td><td>This script generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
|
||
|
<br>
|
||
|
./servo_demo.py # Generate pulses on GPIO 4.<br>
|
||
|
<br>
|
||
|
./servo_demo.py 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_sonar_trigger_echo_py"><a href="code/sonar_trigger_echo_py.zip">Sonar Ranger</a><br>2014-06-12</span></td><td>Class to read sonar rangers with separate trigger and echo pins.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_TCS3200_py"><a href="code/TCS3200_py.zip">TCS3200 Colour Sensor</a><br>2015-07-03</span></td><td>Class to read the TCS3200 colour sensor<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_vw"><a href="code/vw.zip">Virtual Wire</a><br>2015-10-31</span></td><td>Class to send and receive radio messages compatible with the Virtual Wire library for Arduinos. This library is commonly used with 313MHz and 434MHz radio tranceivers.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/create_wave.py"><a href="code/create_wave.py">Wave create</a><br>2019-11-18</span></td><td>Script to generate waves from a template defined in a text file.<br>
|
||
|
<br>
|
||
|
You can also specify one of py, c, or pdif - the script output will then be a complete program to generate the wave (py for Python script, c for a C program, pdif for a C program using the pigpio daemon I/F).<br>
|
||
|
<br>
|
||
|
If none of py, c, or pdif are chosen the waveform will be generated for 30 seconds.<br>
|
||
|
<br>
|
||
|
Example text file<br>
|
||
|
<br>
|
||
|
# GPIO levels<br>
|
||
|
23 11000001<br>
|
||
|
11 01110000<br>
|
||
|
12 00011100<br>
|
||
|
4 00000111<br>
|
||
|
<br>
|
||
|
To generate a pdif program with a bit time of 100 microseconds<br>
|
||
|
./create_wave.py wave_file 100 pdif >wave_pdif.c<br>
|
||
|
<br>
|
||
|
To just transmit the wave with a bit time of 50 microseconds<br>
|
||
|
./create_wave.py wave_file 50<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wave_PWM_py"><a href="code/wave_PWM_py.zip">Wave PWM 1</a><br>2016-03-19</span></td><td>Script to show how waves may be used to generate PWM at (one) arbitrary frequency on multiple GPIO. For instance PWM at 10kHz may be generated with 100 steps between off and fully on.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wavePWM_py"><a href="code/wavePWM_py.zip">Wave PWM 2</a><br>2016-10-06</span></td><td>Class to generate PWM on multiple GPIO. It is more flexible than the Wave PWM 1 example in that the start of the pulse within each cycle may be specified as well as the duty cycle. The start and length of each pulse may be specified on a GPIO by GPIO basis in microseconds or as a fraction of the cycle time. The class includes a __main__ to demostrate its ability to send servo pulses.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wiegand_py"><a href="code/wiegand_py.zip">Wiegand Reader</a><br>2014-06-12</span></td><td>Class to read a Wiegand reader.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="Miscellaneous related code">Miscellaneous related code</span></h3>
|
||
|
The following code examples do not use pigpio.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_adxl345_c"><a href="code/adxl345_c.zip">ADXL345</a><br>2014-03-12</span></td><td>This C program reads x, y, and z accelerations from the ADXL345 via I2C address 0x53.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_DS18B20_py"><a href="code/DS18B20_py.zip">DS18B20 Temperature Sensor</a><br>2016-04-25</span></td><td>This Python script reads the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
|
||
|
<br>
|
||
|
To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
|
||
|
<br>
|
||
|
dtoverlay=w1-gpio<br>
|
||
|
<br>
|
||
|
By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
|
||
|
<br>
|
||
|
Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_EasyAsPiServer"><a href="code/EasyAsPiServer.zip">Easy as Pi Server</a><br>2014-09-15</span></td><td>This Python class implements a simple server which allows broswer commands to be executed on the Pi.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_clk"><a href="code/minimal_clk.zip">Minimal Clock Access</a><br>2015-05-20</span></td><td>This C code sets GPIO 4 to a specified clock frequency. The frequency can be set between 4.6875 kHz and 500 MHz (untested). The clock can be preferentially set from one of the sources OSC (19.2MHz), HDMI (216MHz), PLLD (500MHz), or PLLC (1000MHz). MASH can be set between 0 and 3. MASH may not work properly for clock dividers less than 5.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_gpio"><a href="code/minimal_gpio.zip">Minimal GPIO Access</a><br>2019-07-03</span></td><td>This C code has a minimal set of functions needed to control the GPIO and other Broadcom peripherals. The program requires root privileges to run. See Tiny GPIO access for an alternative which controls the GPIO (but not the other peripherals) and does not require root access.<br>
|
||
|
<br>
|
||
|
The code has been updated for the BCM2711 (Pi4B).<br>
|
||
|
<br>
|
||
|
The following functions are provided.<br>
|
||
|
<br>
|
||
|
gpioInitialise<br>
|
||
|
gpioSetMode<br>
|
||
|
gpioGetMode<br>
|
||
|
gpioSetPullUpDown<br>
|
||
|
gpioRead<br>
|
||
|
gpioWrite<br>
|
||
|
gpioTrigger<br>
|
||
|
gpioReadBank1<br>
|
||
|
gpioReadBank2<br>
|
||
|
gpioClearBank1<br>
|
||
|
gpioClearBank2<br>
|
||
|
gpioSetBank1<br>
|
||
|
gpioSetBank2<br>
|
||
|
gpioHardwareRevision<br>
|
||
|
gpioTick<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_nanopulse_c"><a href="code/nanopulse_c.zip">Nanosecond Pulse Generation</a><br>2014-01-29</span></td><td>This C program uses the PWM peripheral to generate precisely timed pulses of very short duration. Pulses as short as 4 nano seconds can be generated.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_PCF8591-x"><a href="code/PCF8591-x.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>C and Python code to read the (I2C) PCF8591.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_code/spi-driver-speed.c"><a href="code/spi-driver-speed.c">SPI Linux driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the Linux SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_tiny_gpio"><a href="code/tiny_gpio.zip">Tiny GPIO Access</a><br>2016-04-30</span></td><td>This C code has a minimal set of functions needed to control the GPIO without needing root privileges (it uses /dev/gpiomem to access the GPIO).<br>
|
||
|
<br>
|
||
|
You may need to change the permissions and ownership of /dev/gpiomem if they have not been correctly set up.<br>
|
||
|
<br>
|
||
|
sudo chown root:gpio /dev/gpiomem<br>
|
||
|
sudo chmod g+rw /dev/gpiomem<br>
|
||
|
<br>
|
||
|
The user (default pi) needs to be in the gpio group.<br>
|
||
|
<br>
|
||
|
sudo adduser pi gpio<br>
|
||
|
<br>
|
||
|
The following functions are provided.<br>
|
||
|
<br>
|
||
|
gpioInitialise<br>
|
||
|
gpioSetMode<br>
|
||
|
gpioGetMode<br>
|
||
|
gpioSetPullUpDown<br>
|
||
|
gpioRead<br>
|
||
|
gpioWrite<br>
|
||
|
gpioTrigger<br>
|
||
|
gpioReadBank1<br>
|
||
|
gpioReadBank2<br>
|
||
|
gpioClearBank1<br>
|
||
|
gpioClearBank2<br>
|
||
|
gpioSetBank1<br>
|
||
|
gpioSetBank2<br>
|
||
|
gpioHardwareRevision<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="External links">External links</span></h3>
|
||
|
Related code.<br>
|
||
|
<br>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/stripcode/pigpio-stepper-motor"><a href="https://github.com/stripcode/pigpio-stepper-motor">Stepper Motor</a><br>2016-08-12</span></td><td>Stepper motor code.<br>
|
||
|
<br>
|
||
|
</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/choeffer/360pibot"><a href="https://github.com/choeffer/360pibot">Parallax ActivityBot 360</a><br>2018-11-03</span></td><td>Python 3 implementation for programming a Parallax ActivityBot 360 Robot Kit with a Raspberry Pi.<br>
|
||
|
<br>
|
||
|
</td></tr></tbody></table><h3><span id="Index">Index</span></h3>
|
||
|
<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody>
|
||
|
<tr><td><span id="index_433mhz_keyfob_rx/tx"></span>433MHz Keyfob RX/TX</td><td> <a href="#pdif2__433D">pdif2</a>
|
||
|
<a href="#Python__433_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_7-segment_led_display_multiplexing"></span>7-Segment LED Display Multiplexing</td><td> <a href="#Python__7_segment">Python</a>
|
||
|
</td></tr><tr><td><span id="index_adxl345"></span>ADXL345</td><td> <a href="#Misc_adxl345_c">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_apa102_led_strip_driver"></span>APA102 LED strip driver</td><td> <a href="#Python_test-APA102_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_bme280_sensor"></span>BME280 Sensor</td><td> <a href="#Python_BME280_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_dht11/21/22/33/44_sensor"></span>DHT11/21/22/33/44 Sensor</td><td> <a href="#pdif2_DHTXXD">pdif2</a>
|
||
|
<a href="#Python_code/DHT.py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_dht22_am2302_sensor"></span>DHT22 AM2302 Sensor</td><td> <a href="#Python_DHT22_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_ds18b20_temperature_sensor"></span>DS18B20 Temperature Sensor</td><td> <a href="#Python_DS18B20-1_py">Python</a>
|
||
|
<a href="#Misc_DS18B20_py">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_dust_sensor"></span>Dust Sensor</td><td> <a href="#Python_PPD42NS_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_easy_as_pi_server"></span>Easy as Pi Server</td><td> <a href="#Misc_EasyAsPiServer">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_frequency_counter_1"></span>Frequency Counter 1</td><td> <a href="#C_freq_count_1">C</a>
|
||
|
</td></tr><tr><td><span id="index_frequency_counter_2"></span>Frequency Counter 2</td><td> <a href="#C_freq_count_2">C</a>
|
||
|
</td></tr><tr><td><span id="index_gpio_status"></span>GPIO Status</td><td> <a href="#Python_gpio_status_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_gpio_test"></span>GPIO test</td><td> <a href="#Shell_gpiotest">Shell</a>
|
||
|
</td></tr><tr><td><span id="index_hall_effect_sensor"></span>Hall Effect Sensor</td><td> <a href="#C_hall">C</a>
|
||
|
<a href="#Python_hall">Python</a>
|
||
|
</td></tr><tr><td><span id="index_hx711_24-bit_adc"></span>HX711 24-bit ADC</td><td> <a href="#Python_HX711_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_adxl345_accelerometer"></span>I2C ADXL345 Accelerometer</td><td> <a href="#Python_i2c_ADXL345_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_hmc5883l_magnetometer"></span>I2C HMC5883L Magnetometer</td><td> <a href="#Python_i2c_HMC5883L_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_itg3205_gyroscope"></span>I2C ITG3205 Gyroscope</td><td> <a href="#Python_i2c_ITG3205_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_lcd_display"></span>I2C LCD Display</td><td> <a href="#Python_i2c_lcd_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_slave_device"></span>I2C slave device</td><td> <a href="#Python_bsc_arduino_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_sniffer"></span>I2C Sniffer</td><td> <a href="#C_I2C_sniffer">C</a>
|
||
|
<a href="#Python_I2C_sniffer">Python</a>
|
||
|
</td></tr><tr><td><span id="index_i2c_sonar"></span>I2C Sonar</td><td> <a href="#Python_i2c_sonar_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_ir_receiver"></span>IR Receiver</td><td> <a href="#Hardware_ex_ir_remote">Hardware</a>
|
||
|
<a href="#C_ir_hasher_c">C</a>
|
||
|
<a href="#C++_ir_hasher_cpp">C++</a>
|
||
|
<a href="#Python_ir_hasher_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_ir_record_and_playback"></span>IR Record and Playback</td><td> <a href="#Python_irrp_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_kivy_gpio_control"></span>Kivy GPIO control</td><td> <a href="#Python_kivy_GPIO_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_light_dependent_resistor"></span>Light Dependent Resistor</td><td> <a href="#Hardware_ex_LDR">Hardware</a>
|
||
|
</td></tr><tr><td><span id="index_max6675_spi_temperature_sensor"></span>MAX6675 SPI Temperature Sensor</td><td> <a href="#Python_MAX6675_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_minimal_clock_access"></span>Minimal Clock Access</td><td> <a href="#Misc_minimal_clk">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_minimal_gpio_access"></span>Minimal GPIO Access</td><td> <a href="#Misc_minimal_gpio">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_monitor_gpio"></span>Monitor GPIO</td><td> <a href="#Python_monitor_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_morse_code"></span>Morse Code</td><td> <a href="#Python_morse_code_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_motor_shield"></span>Motor Shield</td><td> <a href="#Hardware_ex_motor_shield">Hardware</a>
|
||
|
</td></tr><tr><td><span id="index_nanosecond_pulse_generation"></span>Nanosecond Pulse Generation</td><td> <a href="#Misc_nanopulse_c">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_nrf24_radio_transceiver"></span>NRF24 radio transceiver</td><td> <a href="#Python_code/NRF24.py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_parallax_activitybot_360"></span>Parallax ActivityBot 360</td><td> <a href="#External_https://github.com/choeffer/360pibot">External</a>
|
||
|
</td></tr><tr><td><span id="index_pca9685_16_channel_pwm"></span>PCA9685 16 Channel PWM</td><td> <a href="#Python_PCA9685_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_pcf8591_yl-40"></span>PCF8591 YL-40</td><td> <a href="#C_PCF8591">C</a>
|
||
|
<a href="#Python_PCF8591">Python</a>
|
||
|
<a href="#Misc_PCF8591-x">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_pigpio_benchmark"></span>pigpio Benchmark</td><td> <a href="#Python_bench_1_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_pigpio_cgi"></span>pigpio CGI</td><td> <a href="#Python_pigpio_cgi_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_playback_piscope_recordings"></span>Playback piscope recordings</td><td> <a href="#Python_playback_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_pot_+_capacitor_recharge_timing"></span>Pot + Capacitor Recharge Timing</td><td> <a href="#C_pot_cap_charge_c">C</a>
|
||
|
<a href="#Python_pot_cap_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_generation"></span>PPM (Pulse Position Modulation) generation</td><td> <a href="#Python_code/PPM.py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_to_servo_pulses"></span>PPM (Pulse Position Modulation) to servo pulses</td><td> <a href="#Python_code/PPM_to_servo.py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_pwm_monitor"></span>PWM Monitor</td><td> <a href="#Python_read_PWM_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_rotary_encoder"></span>Rotary Encoder</td><td> <a href="#Hardware_ex_rotary_encoder">Hardware</a>
|
||
|
<a href="#C_rotary_encoder_c">C</a>
|
||
|
<a href="#C++_rotary_encoder_cpp">C++</a>
|
||
|
<a href="#pdif2_RED">pdif2</a>
|
||
|
<a href="#Python_rotary_encoder_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_rpm_monitor"></span>RPM Monitor</td><td> <a href="#Python_read_RPM_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_servo_pulse_generator"></span>Servo Pulse Generator</td><td> <a href="#C_servo_demo">C</a>
|
||
|
<a href="#pdif2_servo_demo_D">pdif2</a>
|
||
|
<a href="#Python_servo_demo_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_si7021_i2c_temperature_and_humidity_sensor"></span>Si7021 I2C Temperature and Humidity Sensor</td><td> <a href="#Python_Si7021_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_sonar_ranger"></span>Sonar Ranger</td><td> <a href="#Hardware_ex_sonar_ranger">Hardware</a>
|
||
|
<a href="#pdif2_SRTED">pdif2</a>
|
||
|
<a href="#Python_sonar_trigger_echo_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008"></span>SPI bit bang MCP3008</td><td> <a href="#C_rawMCP3008_c">C</a>
|
||
|
</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008_and_mcp3202"></span>SPI bit bang MCP3008 and MCP3202</td><td> <a href="#C_rawMCP3XXX_c">C</a>
|
||
|
</td></tr><tr><td><span id="index_spi_bit_bang_mcp3202"></span>SPI bit bang MCP3202</td><td> <a href="#C_rawMCP3202_c">C</a>
|
||
|
</td></tr><tr><td><span id="index_spi_linux_driver_speed_test"></span>SPI Linux driver speed test</td><td> <a href="#Misc_code/spi-driver-speed.c">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_spi_monitor"></span>SPI Monitor</td><td> <a href="#Python_SPI_mon_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_spi_pigpio_driver_speed_test"></span>SPI pigpio driver speed test</td><td> <a href="#C_code/spi-pigpio-speed.c">C</a>
|
||
|
</td></tr><tr><td><span id="index_stepper_motor"></span>Stepper Motor</td><td> <a href="#External_https://github.com/stripcode/pigpio-stepper-motor">External</a>
|
||
|
</td></tr><tr><td><span id="index_tcs3200_colour_sensor"></span>TCS3200 Colour Sensor</td><td> <a href="#Python_TCS3200_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_tiny_gpio_access"></span>Tiny GPIO Access</td><td> <a href="#Misc_tiny_gpio">Misc</a>
|
||
|
</td></tr><tr><td><span id="index_transmit_rotary_encoder_test_signals"></span>Transmit Rotary Encoder Test Signals</td><td> <a href="#pdif2_tx_RED">pdif2</a>
|
||
|
</td></tr><tr><td><span id="index_transmit_wiegand_test_signals"></span>Transmit Wiegand Test Signals</td><td> <a href="#pdif2_tx_WD">pdif2</a>
|
||
|
</td></tr><tr><td><span id="index_virtual_wire"></span>Virtual Wire</td><td> <a href="#Python_vw">Python</a>
|
||
|
</td></tr><tr><td><span id="index_wave_create"></span>Wave create</td><td> <a href="#Python_code/create_wave.py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_wave_pwm_1"></span>Wave PWM 1</td><td> <a href="#Python_wave_PWM_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_wave_pwm_2"></span>Wave PWM 2</td><td> <a href="#Python_wavePWM_py">Python</a>
|
||
|
</td></tr><tr><td><span id="index_wiegand_reader"></span>Wiegand Reader</td><td> <a href="#C_wiegand_c">C</a>
|
||
|
<a href="#C++_wiegand_cpp">C++</a>
|
||
|
<a href="#pdif2_WD">pdif2</a>
|
||
|
<a href="#Python_wiegand_py">Python</a>
|
||
|
</td></tr></tbody></table>
|