@@ -0,0 +1,1759 @@
+from flask import Flask, render_template%0Afrom flask.ext.socketio import SocketIO, emit%0A%0Aimport sys #exit%0Aimport signal #signal%0A%0Aimport myComm%0A%0Adef shutdown_server():%0A    print(%22%5CrYou pressed Ctrl+C!%22)%0A    #net.disconnect()%0A    sys.exit(0)%0A    %0Adef signal_handler(signal, frame):%0A    shutdown_server()%0A    %0Aprint(%22Flask running...%22)%0Asignal.signal(signal.SIGINT, signal_handler)%0Aapp = Flask(__name__)%0Aapp.debug = False%0Aapp.config%5B'SECRET_KEY'%5D = 'secret!'%0Asocketio = SocketIO(app)%0A%0Adef onNetMsg(msg):%0A    print(msg)%0A    but = True if msg=='Button ON' else False%0A    socketio.emit('butRState', %7B'but': but%7D, namespace='/test')%0A%0Adef onSerialMsg(msg):%0A    print(msg)%0A    but = True if msg=='BUT oN' else False%0A    socketio.emit('butAState', %7B'but': but%7D, namespace='/test')%0A%0Anet = myComm.myNet()%0Anet.onMsg = onNetMsg%0A#net.connect('192.168.1.91', 12345)%0Anet.connect('10.0.0.4', 12345)%0A%0Aser = myComm.mySerial()%0Aser.onMsg = onSerialMsg%0Aser.connect('/dev/ttyACM0')%0A%0A%0A@app.route('/')%0Adef index():%0A    return render_template('index.html')%0A%0A@socketio.on('my event', namespace='/test')%0Adef test_message(message):%0A    print(message%5B'data'%5D)%0A%0A@socketio.on('connect', namespace='/test')%0Adef test_connect():%0A    print('Client connected')%0A%0A@socketio.on('disconnect', namespace='/test')%0Adef test_disconnect():%0A    print('Client disconnected')%0A%0A@socketio.on('ledRCtrl', namespace='/test')%0Adef ledRCtrl(message):%0A    print(message%5B'led'%5D)%0A    if message%5B'led'%5D:%0A        net.sendMsg('l1')%0A    else:%0A        net.sendMsg('l0')%0A%0A@socketio.on('ledACtrl', namespace='/test')%0Adef ledACtrl(message):%0A    print(message%5B'led'%5D)%0A    if message%5B'led'%5D:%0A        ser.sendMsg('l1')%0A    else:%0A        ser.sendMsg('l0')%0A%0Aif __name__ == '__main__':%0A    socketio.run(app, host='0.0.0.0', port=5001)%0A

Create ledbut.py