From 07a27920eb51b4e5361a7c28723dc71810e05fa1 Mon Sep 17 00:00:00 2001 From: tpollina Date: Tue, 10 Dec 2019 00:09:26 -0800 Subject: [PATCH] Create test_RGB_fan.py --- test_RGB_fan.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test_RGB_fan.py diff --git a/test_RGB_fan.py b/test_RGB_fan.py new file mode 100644 index 0000000..7c44b68 --- /dev/null +++ b/test_RGB_fan.py @@ -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() + + +