- Thread starter
- #31
Good Morning did you get your LED lights figured out I just got a set going if interested pretty cheap, simple, with Pi3Interesting, how are you dimming the lights and what type of light are you using?
JT
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Good Morning did you get your LED lights figured out I just got a set going if interested pretty cheap, simple, with Pi3Interesting, how are you dimming the lights and what type of light are you using?
JT
Good Morning did you get your LED lights figured out I just got a set going if interested pretty cheap, simple, with Pi3
import time
import RPi.GPIO as GPIO
# PWM Pin
led_pin = 12
# Use "GPIO" pin numbering
GPIO.setmode(GPIO.BOARD)
# Set LED pin as output
GPIO.setup(led_pin, GPIO.OUT)
# Initialize PMW this is the on off duty cycle
pwm = GPIO.PWM(led_pin, 100) # this number controls the speed of the cycle
pwm.start(0)
# Set PWM duty cycle to 90%, wait, then to 70% down to 5% then off
# Time is in seconds 1 minute = 60 seconds
# 900 seconds = 15 minutes to test change all time.sleep(2) this will be 2 # # seconds light will come on 2 seconds and dim down each cycle
pwm.ChangeDutyCycle(90)
time.sleep(900) # 900 seconds = 15 minutes 15x60=900
pwm.ChangeDutyCycle(70)
time.sleep(900)
pwm.ChangeDutyCycle(50)
time.sleep(600) # 600 seconds = 10 minutes
pwm.ChangeDutyCycle(30)
time.sleep(300) # 300 seconds = 5 minutes
pwm.ChangeDutyCycle(20)
time.sleep(150) # 150 seconds = 2 1/2 minutes
pwm.ChangeDutyCycle(10)
time.sleep(150)
# Stop, cleanup, and exit
pwm.stop()
GPIO.cleanup()
I'm using a 12 volt DC LED because I have 12 VDC to operate my door. You can link together up to 20 I used 4, 1 is fairly bright.
Link to LED