import serial
import time
import random
import sys

# Give port name of your UART as first argument. No error checking
# here, sorry.
#
ser = serial.Serial(sys.argv[1], 9600,  timeout = 1)

serwrite = lambda x: ser.write(bytearray(map(ord, x)))
move_to = lambda x, y: serwrite("\x1B[{0};{1}H".format(y, x))

serwrite("xxxxx\x08") # dismiss if we're left in ANSI mode...
serwrite("\x1B[0]") # Text mode
serwrite("\x1B[2J") # Clear screen
serwrite("\x1B[m") # Reset colors
serwrite("\x1B[?7l") # disable wrap

image=[
"................................................................",
"................................................................",
"................................................................",
"................................................................",
"................................................................",
"................................................................",
"................................................................",
"...............................  ...............................",
"..............................    ..............................",
".............................      .............................",
".............................      .............................",
"............................        ............................",
"...........................          ...........................",
"...........................          ...........................",
"..........................            ..........................",
"..........................     ..     ..........................",
".........................      ..      .........................",
"........................      ....      ........................",
"........................     ......     ........................",
".......................      ......      .......................",
"......................      ........      ......................",
"......................      ........      ......................",
".....................      ..........      .....................",
"....................      ............      ....................",
"....................      ............      ....................",
"...................      ........   ...      ...................",
"...................     ........     ...     ...................",
"..................      ........     ...      ..................",
".................      .........    .....      .................",
".................     ............ .......     .................",
"................      ....       .........      ................",
"...............      ....         .........      ...............",
"...............      ...           ........      ...............",
"..............      ...   .        .........      ..............",
"..............     ...   ..        ..........     ..............",
".............      ...   .          .........      .............",
"............      .....         .   ..........      ............",
"............     ........      ...  ...........     ............",
"...........      ..........    ...  ...........      ...........",
"..........      ........  ...    .  ............      ..........",
"..........      ........    ...      ...........      ..........",
".........      .........      ...    .....  .....      .........",
"........      .........        ....    ..    .....      ........",
"........      .........   ...   .....        .....      ........",
".......      ..........   ....  .......       .....      .......",
".......     ..........    ....   ......       ......     .......",
"......      ..........   .....   ....          .....      ......",
".....      ...........   .....   ...           ......      .....",
".....     ............  ......   ...            ......     .....",
"....      ...........   ......   ...            ......      ....",
"...      ............   .......  ..              ......      ...",
"...      ............. ........ ...              ......      ...",
"..      ................................................      ..",
"..     ..................................................     ..",
".                                                              .",
"                                                                ",
"                                                                ",
"                                                                ",
".                                                              .",
"................................................................",
"................................................................",
"................................................................",
"................................................................",
"................................................................"
]

nums = [ "..", ". ", " .", "  " ]

for row in range(16):
	for char in range(32):
		num = 0
		for index in range (row * 4, row * 4 + 4):
			num <<= 2
			num |= nums.index(image[index][(char * 2):(char * 2) + 2][:2])
		if num in [8,10,13,27,127]:
			serwrite(chr(27) + chr(num))
		else:
			serwrite(chr(num))
	if row < 15:
		serwrite(chr(13))

ser.flush()
time.sleep(2)

for i in range(5):
	for x in range(17):
		serwrite("\x1B[{0}]".format(x))
		ser.flush()
		time.sleep(0.05)
	for x in range(16,-1,-1):
		serwrite("\x1B[{0}]".format(x))
		ser.flush()
		time.sleep(0.05)

for x in range(17):
	serwrite("\x1B[{0}]".format(x))
	ser.flush()
	time.sleep(0.05)

ser.flush()
ser.close()

Add rude graphics mode tester