r>
#include &lt;pigpio.h&gt;<br>
<br>
/*<br>
&nbsp;&nbsp; Rotary encoder connections:<br>
<br>
&nbsp;&nbsp; Encoder A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
18&nbsp;&nbsp; (pin P1-12)<br>
&nbsp;&nbsp; Encoder B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
7&nbsp;&nbsp;&nbsp; (pin P1-26)<br>
&nbsp;&nbsp; Encoder Common - Pi ground (pin P1-20)<br>
*/<br>
<br>
#define ENCODER_A 18<br>
#define ENCODER_B&nbsp; 7<br>
<br>
static volatile int encoderPos;<br>
<br>
/* forward declaration */<br>
<br>
void encoderPulse(int gpio