我使用http Web服务器python脚本:
class PiFaceWebHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
[....]
if __name__ == "__main__":
# get the port
if len(sys.argv) > 1:
port = int(sys.argv[1])
else:
port = DEFAULT_PORT
# set up PiFace Digital
PiFaceWebHandler.pifacedigital = pifacedigitalio.PiFaceDigital()
print("Starting simple PiFace web control at:\n\n"
"\thttp://{addr}:{port}\n\n"
"Change the output_port with:\n\n"
"\thttp://{addr}:{port}?output_port=0xAA\n"
.format(addr=get_my_ip(), port=port))
# run the server
server_address = ('', port)
try:
httpd = http.server.HTTPServer(server_address, PiFaceWebHandler)
httpd.serve_forever()
except KeyboardInterrupt:
print('^C received, shutting down server')
httpd.socket.close()
它工作正常,但我希望脚本(或另一个)在一个while循环中连续检查一些i/O。 有时这个I/O可以通过http请求改变状态。 目前,I/O在http请求上更改状态,但在外部触发器(另一个输入ie)上找不到更改它们的提示。你知道吗
我该怎么办?在哪里可以编写循环测试代码?你知道吗
我说清楚了吗?你知道吗
谢谢你
目前没有回答
相关问题 更多 >
编程相关推荐