Uses the Libgpiod library to move a servo
This example will show how to control a servo, which is a fine-tuned motor which moves to a certain position and then rests. A servo has a motor and a sensor which moves to a certain position through a closed-loop system and are commonly used in robotics, steering for remote controls cars, and precise movement. Unlike a Direct Current motor which spins at many revolutions-per-minute (rpm), the servo motor usually move 180 degrees. A closed-loop servo usually has a pin on the inside of the servo motor casing to prevent it from rotating beyond 180 degrees. An open-loop servo allows the servo to move 360 degrees, although quite slowly, which is at a rate of 1 rpm.
Install instructions are:
- sudo apt install swig python-dev python3-dev
- sudo apt install python-setuptools python3-setuptools
- sudo apt install libunwind8
- wget http://abyz.me.uk/lg/lg.zip
- unzip lg.zip
- cd lg
- make
- sudo make install
- Open and compile the LibGPIODServo program and copy the program and libraries to the RaspberryPi Desktop
- give the executable permission to run with something like: 'sudo chmod +x LibGPIODServo
- run the program with something like: 'sudo ./LibGPIODServo