Author Topic: RGB LED Control From Computer  (Read 3916 times)

albert

  • Newbie
  • *
  • Posts: 3
RGB LED Control From Computer
« 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?
« Last Edit: January 04, 2013, 11:52:20 am by albert »

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
RGB LED Control From Computer
« Reply #1 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.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB LED Control From Computer
« Reply #2 on: January 05, 2013, 12:52:49 am »
Check out the latest update for several programs to interact with DigiBlink

albert

  • Newbie
  • *
  • Posts: 3
RGB LED Control From Computer
« Reply #3 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.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
RGB LED Control From Computer
« Reply #4 on: January 06, 2013, 08:29:37 pm »
albert which operating system are you using?