Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, send_from_directory
- import serial
- app = Flask(__name__, static_url_path='')
- ser = serial.Serial('/dev/tty.usbmodem1421')
- print(ser)
- @app.route('/start')
- def start():
- return send_from_directory('','start.html')
- @app.route('/on')
- def on():
- ser.write('r.turnOff();\n')
- return 'on'
- @app.route('/off')
- def off():
- ser.write('r.turnOn();\n')
- return 'off'
- if __name__ == '__main__':
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement