Created
March 15, 2018 12:49
-
-
Save dirkjanfaber/13900fa4c0b63fccc825dfc99671b423 to your computer and use it in GitHub Desktop.
Drive a servo via pwm on the Raspberry Pi from bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor/software | |
gpio -g mode 18 pwm | |
gpio pwm-ms | |
gpio pwmc 192 | |
gpio pwmr 2000 | |
while [ 1 -gt 0 ] | |
do | |
for i in $(seq 100 200) | |
do | |
gpio -g pwm 18 ${i} | |
done | |
for i in $(seq 200 -2 100) | |
do | |
gpio -g pwm 18 ${i} | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment