SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Adafruit_BBIO.PWM as PWM
  2. import Adafruit_BBIO.GPIO as GPIO
  3. from time import sleep
  4.  
  5. delay=0.2
  6. pins=["P9_14", "P9_16", "P8_19", "P8_13"]
  7.  
  8. for pin in pins:
  9.     PWM.start(pin, 100)
  10.     PWM.cleanup(pin)
  11. for pin in pins:
  12.     PWM.start(pin, 0)
  13.  
  14. for i in range(0,4):
  15.     PWM.set_duty_cycle(pins[0], 50)
  16.     PWM.set_duty_cycle(pins[1], 100)
  17.     PWM.set_duty_cycle(pins[2], 50)
  18.     PWM.set_duty_cycle(pins[3], 100)
  19.     sleep(delay)
  20.    
  21.     PWM.set_duty_cycle(pins[0], 100)
  22.     PWM.set_duty_cycle(pins[1], 50)
  23.     PWM.set_duty_cycle(pins[2], 100)
  24.     PWM.set_duty_cycle(pins[3], 50)
  25.     sleep(delay)
  26.  
  27.     i=i+1
  28.     if i > 2:
  29.         continue
  30.  
  31. for i in range(0,4):
  32.     PWM.set_duty_cycle(pins[0], 100)
  33.     PWM.set_duty_cycle(pins[1], 100)
  34.     PWM.set_duty_cycle(pins[2], 50)
  35.     PWM.set_duty_cycle(pins[3], 50)
  36.     sleep(delay)
  37.    
  38.     PWM.set_duty_cycle(pins[0], 50)
  39.     PWM.set_duty_cycle(pins[1], 50)
  40.     PWM.set_duty_cycle(pins[2], 100)
  41.     PWM.set_duty_cycle(pins[3], 100)
  42.     sleep(delay)
  43.  
  44.     i=i+1
  45.     if i > 2:
  46.         continue
  47.  
  48. for i in range(0,4):
  49.     PWM.set_duty_cycle(pins[0], 100)
  50.     PWM.set_duty_cycle(pins[1], 50)
  51.     PWM.set_duty_cycle(pins[2], 50)
  52.     PWM.set_duty_cycle(pins[3], 100)
  53.     sleep(delay)
  54.    
  55.     PWM.set_duty_cycle(pins[0], 50)
  56.     PWM.set_duty_cycle(pins[1], 100)
  57.     PWM.set_duty_cycle(pins[2], 100)
  58.     PWM.set_duty_cycle(pins[3], 50)
  59.     sleep(delay)
  60.  
  61.     i=i+1
  62.     if i > 2:
  63.         continue
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top