Skip to content

Instantly share code, notes, and snippets.

@jezman
Created September 8, 2016 13:20
Show Gist options
  • Save jezman/0c0dbfeefcda889624d676a1b0289adf to your computer and use it in GitHub Desktop.
Save jezman/0c0dbfeefcda889624d676a1b0289adf to your computer and use it in GitHub Desktop.
RapberryPi lcd + pwm
#!/usr/bin/env python
from time import strftime, sleep
import RPi.GPIO as GPIO
pwm_pin = 18
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(pwm_pin, GPIO.OUT)
current_time = strftime('%H')
br = GPIO.PWM(pwm_pin, 50)
if '07' < current_time < '17':
br.ChangeDutyCycle(100)
else:
br.ChangeDutyCycle(50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment