arduino-lights 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/lib/arduino-lights.rb +15 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fad7b707dfa508b074c295f1903672d8a6edc274
|
4
|
+
data.tar.gz: 8c736316e49862c4be6ce0aef46d8a9d2e05cb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db5c9271ec7b183edc41c06eb2db5e941a3b20e89fcad4988d0222f6f107ac9f649c492594f779212400486eb9e8c51dce6e8bb56e2fa6b4406dd02d7468c88e
|
7
|
+
data.tar.gz: 482b6ac77c6663118846455f3c869f0c692f9b3b0fc45a038878c85af3b5d593e385788b7e1a93be5caef8b0a3e447b3237eda0d6242f31a77442cb061ff0925
|
data/lib/arduino-lights.rb
CHANGED
@@ -21,6 +21,21 @@ module ArduinoLights
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.xy_to_pixel_number(x,y)
|
25
|
+
row_offset = y * 12
|
26
|
+
if(y % 2 == 0)
|
27
|
+
column_offset = (11 - x)
|
28
|
+
else
|
29
|
+
column_offset = x
|
30
|
+
end
|
31
|
+
|
32
|
+
row_offset + column_offset
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.set_pixel_xy(x, y, red, green, blue)
|
36
|
+
self.set_pixel(self.xy_to_pixel_number(x, y), red, green, blue)
|
37
|
+
end
|
38
|
+
|
24
39
|
def self.set_pixel(pixel, red, green, blue)
|
25
40
|
# Something about the setup with these LEDs requires a small delay between bytes sent
|
26
41
|
# I don't know if this is about the configuration of ruby-serialport, or the pixel
|