Skip to content

Instantly share code, notes, and snippets.

@bphermansson
Created March 9, 2017 14:18
Show Gist options
  • Save bphermansson/6879b71619456cd4dd2668e20fb1f0ce to your computer and use it in GitHub Desktop.
Save bphermansson/6879b71619456cd4dd2668e20fb1f0ce to your computer and use it in GitHub Desktop.
Python script for testing Raspberry Pi:s hardware PWM
#!/usr/bin/env python
import pigpio
from time import sleep
pi = pigpio.pi()
# Output is Broadcom Gpio12 (physical pin 32)
pi.hardware_PWM(12, 2000, 250000) # 2000Hz 75% dutycycle
sleep(1)
pi.hardware_PWM(12, 2000, 500000)
sleep(1)
pi.hardware_PWM(12, 2000, 750000)
sleep(1)
pi.hardware_PWM(12, 2000, 1000000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment