Dear All
After a lot of struggling for weeks , I can read the serial port readings in
my web page. Below is the code
#!c:\Python27\Python.exe
import cgi, cgitb;
import sys, serial ,time
cgitb.enable()
ser = serial.Serial('COM27', 9600)
numOfLines = 0
print "Content-type:text/html\n\n"
print """
<html>
<head>
<title>
Real Time Temperature
</title>
<body><h1>Real Time Temperature:</h1></body>
"""
while True:
response = ser.readline()
print """
<script type="text/javascript">
var int=self.setInterval(function(){refer()},1000);
function refer()
{
document.getElementById('mine').innerHTML ="""+response+""";
}
</script>
</head>
<body>
<div id="mine"></div>
</body></html>
"""
ser.close()
sys.exit(0)
BUT is this good programming ? I personally do not feel so.
SECONDLY , during the whole execution process , the cursor is showing busy
and I am prevented to click anything else. Why is this so? How to avoid it.
CLEANTECH SOLUTION
www.cleantechsolution.in
SAVE PAPER , SAVE EARTH
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor