digiusb 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,9 @@
1
1
  # A little example program for driving the digirgb example code
2
- # needs colorist rubygem to parse colors
3
2
  require 'digiusb'
4
- require 'colorist'
3
+ require 'digiusb/digiblink.rb'
5
4
 
6
5
  light = DigiUSB.sparks.last # get the spark most recently plugged in (or maybe just a random one? not sure)
7
6
  raise "Couldn't find a DigiUSB device to talk to" if light.nil?
8
7
 
9
- color = ARGV.first.to_color
10
-
11
- # send out each byte
12
- light.putc 's' # start character
13
- light.putc color.r
14
- light.putc color.g
15
- light.putc color.b
16
-
8
+ light.color = ARGV.first
17
9
  puts "Light is now #{ARGV.first}"
@@ -0,0 +1,15 @@
1
+ # little class which abstracts setting colour of digiblink
2
+ require 'digiusb'
3
+ require 'colorist'
4
+
5
+ class DigiBlink < DigiUSB
6
+ def color= value
7
+ color = value.to_color unless value.is_a? Colorist::Color
8
+
9
+ # send out each byte
10
+ self.putc 's' # start character
11
+ self.putc color.r
12
+ self.putc color.g
13
+ self.putc color.b
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digiusb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -69,6 +69,7 @@ executables:
69
69
  extensions: []
70
70
  extra_rdoc_files: []
71
71
  files:
72
+ - lib/digiusb/digiblink.rb
72
73
  - lib/digiusb.rb
73
74
  - readme.txt
74
75
  - license.txt