Advertisement
GammaTroniques

Code Distributeur de Croquette manuel.py

Mar 2nd, 2019
336
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import RPi.GPIO as GPIO
  2. import time
  3. GPIO.setmode(GPIO.BCM)
  4. GPIO.setup(17, GPIO.OUT)
  5. GPIO.setwarnings(False)
  6.  
  7. ajoutAngle = 5
  8. print("ok")
  9. pwm=GPIO.PWM(17,100)
  10. pwm.start(5)
  11.  
  12. angle1 = 80
  13. duty1 = float(angle1)/10 + ajoutAngle
  14.  
  15. angle2=180
  16. duty2= float(angle2)/10 + ajoutAngle
  17.  
  18. pwm.ChangeDutyCycle(duty1)
  19. time.sleep(1)
  20. pwm.ChangeDutyCycle(duty2)
  21. time.sleep(1)
  22. GPIO.cleanup()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement