I have written the following code in Python for my Arduino
#!c:\Python27\Python.exe
import cgi, cgitb;
import sys, serial
cgitb.enable()
ser = serial.Serial('COM27', 9600)
myvar = ser.readline()
print "Content-type:text/html\n\n"
print """
<html>
<head>
<title>
Real Time Temperature
</title>
<script type="text/javascript">
window.onload = startInterval;
function startInterval()
{
setInterval("startTime();",1000);
}
function startTime(myvar)
{
document.getElementById('mine').innerHTML ="Temperature"
+parseInt(myvar);
}
</script>
</head>
<body>
<h1>Real Time Temperature:</h1>
<div id="mine"></div>
</body></html>
"""
I have Apache Web Server
But on running this my localhost , I am getting the following output
"TemperatureNaN" . Why is NaN being showed. Why cant I get the number as
read by se.readline()?
Is there a way to separate the Python code and the Javascript on different
files. If so can you please give a example.?
I am not really interested to do with bottle or other web framework as I
will be controlling my arduino with python from the web and also do video
image processing with openCV. Open CV have a support for Python and not for
Javascript.
Thanks
Subhendu Sinha Chaudhuri
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