User Manual

44
For C language users:
Step 2: Change directory
cd /home/pi/Sunfounder_SuperKit_C_code_for_RaspberryPi/08_RotaryEncoder/
Step 3: Compile
gcc rotaryEncoder.c -o rotaryEncoder -lwiringPi
Step 4: Run
sudo ./rotaryEncoder
For Python users:
Step 2: Change directory
cd /home/pi/Sunfounder_SuperKit_Python_code_for_RaspberryPi/
Step 3: Run
sudo python 08_rotaryEncoder.py
Now, gently rotate the encoder to change the value of the variable in the above program
and you will see the value printed on the screen. Rotate the encoder clockwise, the value
will increase; or rotate it counterclockwise, the value will decrease.
Further Exploration
In this experiment, the pressing down function of rotary encoder is not involved. Try to
explore this function by yourself!