I'm having trouble wrapping my head around the MVC stuff. I'm trying to read and display serial data from an Arduino microcontroller attached to /dev/ttyUSB0 with limited sucess.
Model: (readSerial.py) -------------------------------------------------------- import serial import time ser = serial.Serial('/dev/ttyUSB0', 57600) def serialRead(): timeStr = time.strftime("%H:%M:%S") inLine = timeStr + " : " + ser.readline().strip() return inLine ----------------------------------------------------------- View: (index.hml) ---------------------------------------------------------- <script language="javascript"> $(document).ready(function() { setInterval('serialRead()', 2000); }); function serialRead() { var msg = "<p>{{=serialRead()}}</p>"; $('#console').append(msg); } </script> ... <div id='console'></div> ... --------------------------------------------------------- This appears to work initially, but the repeated calls to readSerial() return the same values (time & serial line). What am I missing conceptually? You can see what I'm working on (hopefully) at http://arduino.hopto.org