boombuler / led

golang package for some LED HID devices
MIT License
23 stars 13 forks source link

Selecting individual LED on blinkstick #5

Open sirchuck opened 5 years ago

sirchuck commented 5 years ago

I couldn't find in the code how to set the color of a particular led on my blinkstick. The sample code does light up the first LED on my stick, but I can't do anything with the rest of the LED's.

This is the item I purchased: https://www.blinkstick.com/products/blinkstick-strip

If you feel like updating the project to handle more than one LED that would be cool. :)

boombuler commented 5 years ago

Could you try, how it behaves If you change the hardcoded 1 at blinkstick.go?

sirchuck commented 5 years ago

I tried a few numbers and got some interesting behavior. 0x01 lights the first LED 0x02, 0x03, 0x04 do nothing 0x05 lights all 8 lights with wrong colors. 0x06, 0x07, 0x08, 0x09 first LED again 0x10-0x50 nothing

So it'll be a guessing game, but with time probably hackable assuming the first byte does address the LED's.

return d.WriteFeature([]byte{0x01, byte(r >> 8), byte(g >> 8), byte(b >> 8)})
rikkuness commented 2 years ago

Sorry to necro, but I've just been playing with this and it looks like to address individual LED's you need to change the byte array you write to be something like this, changing the third byte to be the index of the LED you want to set

return d.WriteFeature([]byte{
    0x05, // report id for indexed colour
    0x00, // RGB channel
    0x00, // LED index
    byte(r >> 8),
    byte(g >> 8),
    byte(b >> 8),
})