rpi_rgb 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e01e9c3c0943668bf817bc9dcbb9f071197704e
4
- data.tar.gz: 6c0cb7dcfa984acdac625b734f66d0c45a40fc65
3
+ metadata.gz: 1848ed1d1f9292e366c714efa43c29634415c467
4
+ data.tar.gz: dee076a5fae50d6500de3546e1d9cae2f5e406df
5
5
  SHA512:
6
- metadata.gz: ad6085cdd8463cbbf6e73bd50259bdf519f893fa65422cf3e0e0ba7cd27b63238bc7b0442ae5045120283d6c263c8255b884a13a8c01da47535d703dcbf04a0d
7
- data.tar.gz: 1dc47c1f0d53d26f501b1a31882fed1e756fd1ea3fc5a3c2f01a9b3d61c5416493d13c239088d190bdfab8109a537f47384c5c4996d442b17abd98bd17e1eb0f
6
+ metadata.gz: 1df4ef4cbc8b46ff1b5a63f24997088d965b76cdd057a2598a4ad34857c0d295ff384811693533a530c6a1f982d13e9902cc40c762f51f815e34aab8239327c7
7
+ data.tar.gz: 1c6fcd6d69c1109e58c08be9f84ebb21c159f6933477baa1f84fc0266fe849f2e5e8688755f339a8e37e17781f5663e5a5affe91286e32ea87e95e7407406c70
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rpi_rgb.rb CHANGED
@@ -9,7 +9,7 @@ require 'rpi_led'
9
9
 
10
10
  =begin
11
11
 
12
- rgb = RPiRGB.new(%w(4 17 27), presets: {purple: [0,100,100]})
12
+ rgb = RPiRGB.new(%w(4 17 27), presets: {purple: [100,100,0]})
13
13
  rgb.color = 'white'
14
14
  sleep 2
15
15
  rgb.color = 'purple'
@@ -29,7 +29,7 @@ class RPiRGB
29
29
  RPiLed.new(x, brightness: brightness, smooth: smooth)
30
30
  end
31
31
 
32
- @brightness, @presets = brightness, presets
32
+ @brightness, @presets = brightness, presets
33
33
 
34
34
  end
35
35
 
@@ -50,16 +50,16 @@ class RPiRGB
50
50
  case val
51
51
 
52
52
  when 'red'
53
- mix @brightness, 0, 0
53
+ mix 100, 0, 0
54
54
 
55
55
  when 'green'
56
- mix 0, @brightness, 0
56
+ mix 0, 100, 0
57
57
 
58
58
  when 'blue'
59
- mix 0, 0, @brightness
59
+ mix 0, 0, 100
60
60
 
61
61
  when 'white'
62
- mix @brightness, @brightness, @brightness
62
+ mix 100, 100, 100
63
63
 
64
64
  else
65
65
 
@@ -81,10 +81,11 @@ class RPiRGB
81
81
 
82
82
  def mix(*values)
83
83
 
84
- values.flatten!
84
+ r, g, b = values.flatten.map {|v| v / (100 / @brightness ) }
85
85
 
86
86
  [@red, @green, @blue].each(&:on)
87
- red.brightness, green.brightness, blue.brightness = values
87
+
88
+ red.brightness, green.brightness, blue.brightness = r, g, b
88
89
  end
89
90
 
90
91
  def off()
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpi_rgb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file