Skip to content

Instantly share code, notes, and snippets.

@J3RN
Created October 17, 2015 17:13
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 J3RN/b364e93270d077731c32 to your computer and use it in GitHub Desktop.
Save J3RN/b364e93270d077731c32 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import RPi.GPIO as GPIO
from time import *
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
pwm = GPIO.PWM(18, 500)
pwm2 = GPIO.PWM(12, 500)
pwm3 = GPIO.PWM(13, 500)
pwm.start(0)
pwm2.start(0)
pwm3.start(0)
while (True):
for i in range(0, 100):
pwm3.ChangeDutyCycle(i)
sleep(0.01)
for i in range(0, 100):
pwm3.ChangeDutyCycle(100 - i)
sleep(0.01)
for i in range(0, 100):
pwm2.ChangeDutyCycle(i)
sleep(0.01)
for i in range(0, 100):
pwm2.ChangeDutyCycle(100 - i)
sleep(0.01)
for i in range(0, 100):
pwm.ChangeDutyCycle(i)
sleep(0.01)
for i in range(0, 100):
pwm.ChangeDutyCycle(100 - i)
sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment