Skip to content

Instantly share code, notes, and snippets.

@bennuttall
Last active February 12, 2016 10:05
Show Gist options
  • Select an option

  • Save bennuttall/88adbaddea47c9ef4af1 to your computer and use it in GitHub Desktop.

Select an option

Save bennuttall/88adbaddea47c9ef4af1 to your computer and use it in GitHub Desktop.
pwmled
from gpiozero import LED
from time import sleep
from signal import pause
led1 = LED(4)
led2 = LED(18)
led1.blink(on_time=1, off_time=1)
sleep(1) # so they're blinking opposite
led2.blink(on_time=1, off_time=1)
pause()
from gpiozero import PWMLED
from time import sleep
led1 = PWMLED(4)
led2 = PWMLED(18)
while True:
for i in list(range(101)) + list(reversed(range(100))):
led1.value = i / 100
led2.value = 1 - (i / 100)
sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment