Create test_RGB_fan.py

This commit is contained in:
tpollina 2019-12-10 00:09:26 -08:00 committed by GitHub
parent 13d3a1e8b2
commit 07a27920eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

34
test_RGB_fan.py Normal file
View file

@ -0,0 +1,34 @@
#!/usr/bin/python
import smbus
from time import sleep
bus = smbus.SMBus(1)
DEVICE_ADDRESS = 0x0d
def led_on(LED, R,G,B):
bus.write_byte_data(DEVICE_ADDRESS, 0x00, LED)
bus.write_byte_data(DEVICE_ADDRESS, 0x01, R)
bus.write_byte_data(DEVICE_ADDRESS, 0x02, G)
bus.write_byte_data(DEVICE_ADDRESS, 0x03, B)
def led_off():
bus.write_byte_data(DEVICE_ADDRESS, 0x07, 0x00)
def breathe_slow():
bus.write_byte_data(DEVICE_ADDRESS, 0x04, 0x01)
def breathe_fast():
bus.write_byte_data(DEVICE_ADDRESS, 0x04, 0x03)
led_off()
led_on(0, 25,58,255)
led_on(1, 25,58,255)
led_on(2, 25,58,255)
sleep(5)
breathe_slow()
sleep(5)
led_off()