print('</table></td><td>') #Print the Digital Input values print('<b>Digital Input Values</b>') print('<table border="1"><tr><td>Input Number</td><td>Input Value</td></tr>\n') for i in range (0,8): try: print ('<tr><td>'+str(i)+'</td><td>'+str(ifk.getInputState(i))+'</td></tr>\n') except: pint('<tr><td>'+str(i)+'</td><td>Could not Read Digital Input State </td></tr>\n') print('</table></td><td>') #Print the Digital Output States print('<b>Digital Output States</b>') print('<table border="1"><tr><td>Output Number</td><td>Output State</td><td>Set True</td><td>Set False</td></tr>\n') for i in range (0,8): try: print ('<tr><td>'+str(i)+'</td><td>'+str(ifk.getOutputState(i))+'</td><td><a href="SetTrue'+str(i)+'.py">Set True</a></td><td><a href="SetFalse'+str(i)+'.py">Set False</a></td></tr>\n') except: pint('<tr><td>'+str(i)+'</td><td>Could not Read Digital Outputt State </td></tr>\n') print('</table></td></tr></table>') print ('<br><br>This page does not automaticly refresh') print ('<br><br><a href="WebInterfaceKit.py">Refresh this page</a>') print('</body></html>\n') ifk.closePhidget() exit(0)
print "Phidget Exception %i: %s" % (e.code, e.message) try: interfaceKit.closePhidget() except PhidgetException, e: print "Phidget Exception %i: %s" % (e.code, e.message) print "Exiting...." exit(1) print "Exiting...." exit(1) print "Output Count: "+str(interfaceKit.getOutputCount()) time.sleep(3) print "Output 0 is currently in state "+str(interfaceKit.getOutputState(0)) print "Press Enter to toggle output 0" chr = sys.stdin.read(1) if interfaceKit.getOutputState(0) is False: print "setting output dtate to True" interfaceKit.setOutputState(0, True) print "done" else: print "setting output state to False" interfaceKit.setOutputState(0, False) print "done" print "Press Enter to quit...." chr = sys.stdin.read(1)
try: interfaceKit.closePhidget() except PhidgetException, e: print "Phidget Exception %i: %s" % (e.code, e.message) print "Exiting...." exit(1) print "Exiting...." exit(1) else: displayDeviceInfo() print "Output Count: " + str(interfaceKit.getOutputCount()) time.sleep(3) print "Output 0 is currently in state " + str(interfaceKit.getOutputState(0)) print "Press Enter to toggle output 0" chr = sys.stdin.read(1) if interfaceKit.getOutputState(0) is False: print "setting output dtate to True" interfaceKit.setOutputState(0, True) print "done" else: print "setting output state to False" interfaceKit.setOutputState(0, False) print "done" print "Press Enter to quit...." chr = sys.stdin.read(1)