Digistump Forums

The Digispark => Digispark Projects => Topic started by: albert on January 04, 2013, 11:52:20 am

Title: RGB LED Control From Computer
Post by: albert on January 04, 2013, 11:52:20 am
So I got my RGB LED shield all soldered together and plugged into my digispark, but I'd like to be able to control the light with my computer. Not exactly sure where to start, can anybody point me in the right direction?
Title: RGB LED Control From Computer
Post by: Bluebie on January 04, 2013, 06:08:51 pm
Check out File > Examples > DigisparkUSB to see the DigiBlink example - it controls an RGB LED over USB just like you say.. You need to have a program on the PC to connect to it and write out rgb bytes. I believe there\'s an example for doing this with python mentioned somewhere in the forums. It\'d be nice and easy to do with ruby too using the digiusb rubygem if you\'re at all familiar with ruby. Here\'s an example of talking to DigiBlink sketch in ruby:

# a ruby program for making a digispark with rgb shield running digiblink turn purple
require \'digiusb\'
light = DigiUSB.sparks.last

light.putc(115) # start character
light.putc(255) # red value
light.putc(0) # green value
light.putc(255) # blue value


I don\'t have an RGB shield though so I haven\'t tested this. Should work though! It\'s a pretty simple program. :)

Anyone want to test if this example works? If it does, I\'ll add a more comprehensive version to the examples folder in the digiusb rubygem.
Title: RGB LED Control From Computer
Post by: digistump on January 05, 2013, 12:52:49 am
Check out the latest update for several programs to interact with DigiBlink
Title: RGB LED Control From Computer
Post by: albert on January 06, 2013, 08:09:34 pm
I\'m trying to get the digiUSB ruby gem to work, but may have borked something on my computer in the process.
Title: RGB LED Control From Computer
Post by: Bluebie on January 06, 2013, 08:29:37 pm
albert which operating system are you using?