[CGSG] SVN Commit r435 - projects/FPGAMatrix/python
wizard23 at metalab.at
wizard23 at metalab.at
Sat Apr 26 03:15:24 CEST 2008
Author: wizard23
Date: 2008-04-26 03:15:24 +0200 (Sat, 26 Apr 2008)
New Revision: 435
Added:
projects/FPGAMatrix/python/Metalab.png
projects/FPGAMatrix/python/upload.py
Log:
Added: projects/FPGAMatrix/python/Metalab.png
===================================================================
(Binary files differ)
Property changes on: projects/FPGAMatrix/python/Metalab.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/FPGAMatrix/python/upload.py
===================================================================
--- projects/FPGAMatrix/python/upload.py (rev 0)
+++ projects/FPGAMatrix/python/upload.py 2008-04-26 01:15:24 UTC (rev 435)
@@ -0,0 +1,46 @@
+from PIL import Image
+import serial
+from time import sleep
+
+
+MATRIX_SIZE = (72, 48)
+
+im = Image.open("Metalab.png")
+
+
+# convert to black white
+bw = im.convert("L")
+
+bw = bw.resize(MATRIX_SIZE)
+
+ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=0.1)
+
+try:
+ ser.write(chr(0xFF))
+ sleep(0.01)
+
+ for y in range(0,6):
+ for x in range(0,9):
+ for xx in range(0,8):
+ for yy in range(0,8):
+ col = bw.getpixel((71-(x*8+xx), y*8+yy))/16
+ #col = yy
+ ser.write(chr(col))
+ print col
+ sleep(0.001)
+ #sleep(0.02)
+except:
+ print "Exception"
+ ser.close()
+
+ser.close()
+
+
+
+#ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=0.1)
+
+
+
+
+
+
More information about the CGSG
mailing list