From b734027e053755eb795de66fdb93b6534ec3370a Mon Sep 17 00:00:00 2001 From: Jakub Zika Date: Mon, 26 Sep 2011 16:00:00 +0200 Subject: [PATCH] Fixed synchronization bugs in Python version --- host_python/demo.py | 1 + host_python/send_to_serial.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/host_python/demo.py b/host_python/demo.py index 929b445..6409d11 100755 --- a/host_python/demo.py +++ b/host_python/demo.py @@ -64,6 +64,7 @@ def main(): b = read_byte() pygame.draw.rect(screen, [r, g, b], [pixel_width*i, 0, pixel_width-offset, pixel_width-offset]) write_byte(r); write_byte(g); write_byte(b) + sys.stdout.flush() pygame.display.flip() except EOFError: pass diff --git a/host_python/send_to_serial.py b/host_python/send_to_serial.py index f9b4d3b..380f8ad 100755 --- a/host_python/send_to_serial.py +++ b/host_python/send_to_serial.py @@ -2,6 +2,7 @@ # vim:et:sw=4:ts=4:sts=4 import sys +import time import serial import getopt @@ -49,6 +50,7 @@ def main(): except serial.serialutil.SerialException: print 'Could not open the serial device' return 1 + time.sleep(2) try: while True: