I had just put those print statements as an example, fixed below
Code: Select all
#! /usr/bin/env python
import cgi
import serial
ser = serial.Serial('/dev/ttyACM0',9600)
ser.write('z050\n') #this is what moves motor (connected to arduino)
ser.close()
print("Content-type: text/html\n\n"
print"<html>These words show up on the new page once button is clicked></html>"
Our HTML is just a simple page that has buttons to move the motor up/down/left/right. When the button is clicked the motor moves correctly but the webrowser goes to a page showing the html in the python script. Here is a sample of where we have in HTML for the buttons:
Code: Select all
#HTML buttons with up/down/left/right arrows
<table>
<tr><td></td><td><a href="/cgi-bin/moveup.py"><button> ▲ </button><br></td></tr><td></td>
<tr>
<td><a href="/cgi-bin/moveleft.py"><button>◄</button><br></td>
<td></td>
<td><a href="/cgi-bin/moveright.py"><button>►</button><br></td>
</tr>
<tr><td></td><td><a href="/cgi-bin/movedown.py"><button>▼</button><br></td></tr><td></td>
</table>