Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Simple Flask App
from flask import Flask
import serial
from datetime import datetime, timedelta
from time import sleep
serial_port = '/dev/tty.usbserial-A501S1GX' # most likely you will need to change this!
ser = serial.Serial(serial_port, 9600)
app = Flask(__name__)
def input(colour, movement):
ser.write('0,{0},{1}\n' .format(colour, movement))
return "Done!"
def output(colour, movement):
ser.write('1,{0},{1}\n' .format(colour, movement))
return "Done!"
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment