Skip to content

Instantly share code, notes, and snippets.

@yamori813
Created April 5, 2019 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamori813/63c4b9cc841530003ad0ee6842ea653b to your computer and use it in GitHub Desktop.
Save yamori813/63c4b9cc841530003ad0ee6842ea653b to your computer and use it in GitHub Desktop.
def copylcd(c, sp)
for n in 1..64 do
rgba = c.getpix(0, n - 1, 128)
for i in 1..16 do
pat = 0
for k in 1..8 do
if rgba[1 + (i - 1) * 4 * 8 + (k - 1) * 4] == 0xff
pat |= 1 << (8 - k)
end
end
bytestr = " "
bytestr.setbyte(0, pat)
sp.write bytestr
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment