Created
February 10, 2014 13:38
-
-
Save theterg/8916090 to your computer and use it in GitHub Desktop.
Raspberry pi wiringpi2 pwm test
This file contains hidden or 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
| import wiringpi2 as wiringpi | |
| import sys | |
| import argparse | |
| import time | |
| parser = argparse.ArgumentParser() | |
| # parser.add_argument('--clock', type=int, default=32) | |
| parser.add_argument('--period', type=int, default=200) | |
| parser.add_argument('--pulsewidth', type=int, default=15) | |
| args = parser.parse_args() | |
| # If using BCM GPIO numbers | |
| wiringpi.wiringPiSetupGpio() | |
| wiringpi.softPwmCreate(18, args.pulsewidth, args.period) | |
| # wiringpi.pinMode(18, 2) # pwm only works on GPIO port 18 | |
| # wiringpi.pwmSetClock(args.clock) | |
| # wiringpi.pwmSetRange(args.period) | |
| # wiringpi.pwmWrite(18, args.pulsewidth) | |
| time.sleep(5.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment