diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..e0dc8a6ef38f4b5a441a21e018f2feb8a7507771 --- /dev/null +++ b/app.py @@ -0,0 +1,26 @@ +from flask import Flask, render_template; +import serial; +import time; + +app = Flask(__name__) + +@app.route('/') +def index(): + return render_template('breath_plot.html') + +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0') + +#ser = serial.Serial('COM4', 112500, timeout=1) +#print(ser.name) +#ser.flushInput() + +#while True: +# try: +# ser.write(b'A') +# time.sleep(0.1) +# ser_bytes = ser.readline() +# print(ser_bytes) +# except KeyboardInterrupt: +# print("Keyboard Interrupt") +# break diff --git a/simple_serial/simple_serial.ino b/simple_serial/simple_serial.ino new file mode 100644 index 0000000000000000000000000000000000000000..59197afab8fba3b0292c95812c7d2d11400566f5 --- /dev/null +++ b/simple_serial/simple_serial.ino @@ -0,0 +1,18 @@ +int incomingByte = 0; // for incoming serial data + +void setup() { + Serial.begin(112500); +} + +void loop() { + // put your main code here, to run repeatedly: + // reply only when you receive data: + if (Serial.available() > 0) { + // read the incoming byte: + incomingByte = Serial.read(); + + // say what you got: + Serial.print("I received: "); + Serial.println(incomingByte, DEC); + } +} diff --git a/js/respiration_math.js b/static/js/respiration_math.js similarity index 100% rename from js/respiration_math.js rename to static/js/respiration_math.js diff --git a/breath_plot.html b/templates/breath_plot.html similarity index 99% rename from breath_plot.html rename to templates/breath_plot.html index a5ac628390e142562f472da524ebb1891da93377..3cc59a71b2ac21d58ef80f57a008b6e2ac7c1739 100644 --- a/breath_plot.html +++ b/templates/breath_plot.html @@ -28,7 +28,7 @@ Breath Plot: COVID-19 Respiration Analysis Software <!-- Load plotly.js into the DOM --> <script src='https://cdn.plot.ly/plotly-latest.min.js'></script> - <script src='./js/respiration_math.js'></script> + <script src='./static/js/respiration_math.js'></script> <title>Public Invention Respiration Analysis</title> @@ -1470,10 +1470,12 @@ $( document ).ready(function() { // CONTROL PANEL INIT START $("#control_area_button").click(function(event) { - alert('Starting ventilator (not really)'); + //alert('Starting ventilator (not really)'); // Send a command to a connected device via serial port + var rr = $("#control-rr").val(); + console.log("rr: " + rr); /*var lh = "http://localhost:8080"; alert('making ajax call'); $.ajax({url: lh+"/README.md",