setcolor.py
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
|
||||||
|
# PINs
|
||||||
|
red = 20
|
||||||
|
green = 21
|
||||||
|
blue = 22
|
||||||
|
|
||||||
|
# frequency for PWM
|
||||||
|
freq = 60
|
||||||
|
|
||||||
|
GPIO.setup(red, GPIO.OUT)
|
||||||
|
GPIO.setup(green, GPIO.OUT)
|
||||||
|
GPIO.setup(blue, GPIO.OUT)
|
||||||
|
|
||||||
|
# defining the pins that are going to be used with PWM
|
||||||
|
RED = GPIO.PWM(red, freq)
|
||||||
|
GREEN = GPIO.PWM(green, freq)
|
||||||
|
BLUE = GPIO.PWM(blue, freq)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
RED.start(100)
|
||||||
|
GREEN.start(1)
|
||||||
|
BLUE.start(1)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
GPIO.cleanup()
|
||||||
Reference in New Issue
Block a user