Guest User

Gpioextender2.py

a guest
Nov 10th, 2013
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import wiringpi2 as wiringpi
  2.  
  3. # If using BCM GPIO numbers
  4. wiringpi.wiringPiSetupGpio()
  5. wiringpi.pinMode(18,2)      # pwm only works on GPIO port 18
  6. wiringpi.pwmWrite(18, 0)    # duty cycle between 0 and 1024. 0 = off, 1024 = fully on
  7.  
  8. # OR, using wiringpi numbers
  9. wiringpi.wiringPiSetup()
  10. wiringpi.pinMode(1,2)      # pwm only works on wiringpi pin 1
  11. wiringpi.pwmWrite(1, 0)    # duty cycle between 0 and 1024. 0 = off, 1024 = fully on
  12.  
  13. # OR, using P1 header pin numbers
  14. wiringpi.wiringPiSetupPhys()
  15. wiringpi.pinMode(12,2)      # pwm only works on P1 header pin 12
  16. wiringpi.pwmWrite(12, 0)    # duty cycle between 0 and 1024. 0 = off, 1024 = fully on
RAW Paste Data