Author Topic: digiterm and digiusb rubygem  (Read 9010 times)

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
digiterm and digiusb rubygem
« on: January 06, 2013, 07:43:11 pm »
before digistump made their program for talking to digiusb on your computer, I made this little rubygem which gets the job done: http://rubygems.org/gems/digiusb - now that there's an official one, the ruby version needs to remain competitive with edgy new features!

the digiusb rubygem gives you classes which let you read and write strings, characters and bytes to and from your digispark through it's digiusb library (provided by digistump built in to the arduino program). today I added some new features:

-> digiterm now has coloured output so you can see which chars were from the digispark and which you typed yourself
-> digiusb's inpect method is a little nicer
-> digiusb/digiblink exists now - a simple little abstraction for the digiblink sketch

the digiblink abstraction is literally 15 lines long, but it means you can do this in ruby: DigiBlink.sparks.first.color = 'red' and it totes makes the first spark it finds turn red!

look, I know you guys love python. python is a really lovely guy and all, but I really think you should consider ruby. ruby is a lovely place to be. ruby has all sorts of great friends who are all really excited to meet you. I think you'll get along great with ruby!

P.S. I tried to run the digistump one and nothing happened? IDK what to do with it.
« Last Edit: January 06, 2013, 07:43:11 pm by Bluebie »

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
digiterm and digiusb rubygem
« Reply #1 on: January 07, 2013, 04:46:35 pm »
update: 1.0.0 - improve digiterm to use about 1.8% cpu instead of about 16% by limiting read speed when digispark drains out of characters.

dmcinnes

  • Newbie
  • *
  • Posts: 21
digiterm and digiusb rubygem
« Reply #2 on: January 07, 2013, 06:35:27 pm »
Awesome work on this! :)

Matir

  • Newbie
  • *
  • Posts: 3
digiterm and digiusb rubygem
« Reply #3 on: January 07, 2013, 09:34:43 pm »
Hi Bluebie -- unfortunately, my ruby skills suck, so I\'m not sure where to go with this, but I\'m getting this when trying to read from my digispark:

digiterm
Looking for Digispark running DigiUSB...
/var/lib/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:72:in `get_pointer\': invalid memory read at address=0x00000000000000 (FFI::NullPointerError)
   from /var/lib/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:72:in `block in device_list\'
   from /var/lib/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:71:in `times\'
   from /var/lib/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:71:in `device_list\'
   from /var/lib/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:109:in `devices\'
   from /var/lib/gems/1.9.1/gems/digiusb-0.0.4/lib/digiusb.rb:17:in `sparks\'
   from /var/lib/gems/1.9.1/gems/digiusb-0.0.4/bin/digiterm:8:in `\'
   from /usr/local/bin/digiterm:23:in `load\'
   from /usr/local/bin/digiterm:23:in `
\'

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
digiterm and digiusb rubygem
« Reply #4 on: January 07, 2013, 09:52:47 pm »
@Matir which operating system?

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
digiterm and digiusb rubygem
« Reply #5 on: January 08, 2013, 05:14:17 am »
Updates:

1.0.1: better debug output when things go wrong on digiterm program
1.0.2: digiusb class automatically throttles gets/read requests instead of thrashing digispark. Improved debug output of digiterm program a little more too.

ej.cardinal

  • Newbie
  • *
  • Posts: 6
Re: digiterm and digiusb rubygem
« Reply #6 on: January 30, 2013, 07:35:05 am »
As a Rubyist, I love it! Thanks for making it so easy to talk to the Digispark via USB on my MacBook Pro. I'm working on making the RGB turn various colors for different events.

zachfeldman

  • Newbie
  • *
  • Posts: 2
Re: digiterm and digiusb rubygem
« Reply #7 on: October 11, 2013, 07:53:26 am »
Thank you so much for this! I used your gem in my DigiLcdServer project to display information on the 16x2 LCD easily. You rock!


Link to project:
https://github.com/zachfeldman/digi-lcd-server