Skip to content

Instantly share code, notes, and snippets.

@sasha42
Created January 5, 2017 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasha42/ff25bb59b50adf03359bb1d3265d8d78 to your computer and use it in GitHub Desktop.
Save sasha42/ff25bb59b50adf03359bb1d3265d8d78 to your computer and use it in GitHub Desktop.
import time, sys, os
global pwm
from Adafruit_PWM_Servo_Driver import PWM
# Set LED parameters
pwm = PWM(0x40)
pwm.setPWMFreq(1000)
print("LEDs are initialised")
while True:
for x in range(10):
pwm.setPWM(2, x*400+1)
print("up {}".format(x*400))
time.sleep(0.1)
for x in range(10):
pwm.setPWM(2, 4001-(x*400))
print("down {}".format(4001-(x*400)))
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment