Created
April 15, 2021 22:20
-
-
Save hrdwrbob/01ba8ea1e97eb2e7aaea66e5422c40cf to your computer and use it in GitHub Desktop.
Copies LED RGB values from a Corsair CUE device to an ambiled device, for maximum unicorn vomit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cuesdk import CueSdk | |
import lightpack | |
import time | |
import colorsys | |
import random | |
def setup(): | |
global ambibox | |
ambibox = lightpack.lightpack('192.168.86.213',3636) | |
ambibox.connect() | |
global numleds | |
numleds = ambibox.getCountLeds() | |
print("LEDs:",numleds) | |
global leds | |
leds = [(0,0,0)] * int(numleds) | |
def main(): | |
#print(leds) | |
#while (time.sleep(.1)): | |
sdk = CueSdk() | |
sdk.connect() | |
setup() | |
device_id = 6 | |
led_positions = sdk.get_led_positions_by_device_index(device_id) | |
ambibox.lock() | |
while (True): | |
colours = [] | |
for colour in list(sdk.get_led_colors_by_device_index(device_id,list(led_positions)).items()): | |
colours.append(colour[1]) | |
print(colours) | |
i=0 | |
for i in range(len(leds)): | |
leds[i] = colours[i%len(colours)] | |
print(i,leds[i]) | |
ambibox.updateColors(leds) | |
time.sleep(0.05) | |
ambibox.unlock() | |
ambibox.disconnect() | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment