Skip to content

Instantly share code, notes, and snippets.

@uwekamper
Last active August 29, 2015 13:56
Show Gist options
  • Save uwekamper/9079899 to your computer and use it in GitHub Desktop.
Save uwekamper/9079899 to your computer and use it in GitHub Desktop.
Matelight in Ruby
require 'socket'
# 3 colors by 30 pixels by 16 pixels + 4 bytes of checksum (which is never checked) = 1924 byts
frame = (1..1924).map{|x|"\xFF"} * ""
u1 = UDPSocket.new
u1.send a, 0, "matelight", 1337
# For the emulator use:
u1.send a, 0, "127.0.0.1", 1337
@XenGi
Copy link

XenGi commented Mar 2, 2014

--- matelight.rb.old    2014-03-02 22:46:02.597235010 +0100
+++ matelight.rb        2014-03-02 22:46:30.397627201 +0100
@@ -1,9 +1,9 @@
 require 'socket'

-# 3 colors by 30 pixels by 16 pixels + 4 bytes of checksum (which is never checked) = 1924 byts
+# 3 colors by 40 pixels by 16 pixels + 4 bytes of checksum (which is never checked) = 1924 byts
 frame = (1..1924).map{|x|"\xFF"} * ""
 u1 = UDPSocket.new
 u1.send a, 0, "matelight", 1337

 # For the emulator use:
-u1.send a, 0, "127.0.0.1", 1337
\ No newline at end of file
+#u1.send a, 0, "127.0.0.1", 1337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment