diff options
Diffstat (limited to 'backend/app.py')
-rw-r--r-- | backend/app.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/backend/app.py b/backend/app.py new file mode 100644 index 0000000..6d38cd4 --- /dev/null +++ b/backend/app.py @@ -0,0 +1,38 @@ +from flask import Flask +from threading import Thread +import os + + +app = Flask(__name__) + +threadFlag = True +def playFunction(freq): + global threadFlag + while not threadFlag: + os.system("beep -f %f" % (freq)) + #print("beep -f %f" % (freq)) + +tc = 0 +@app.before_first_request +def activate_job(): + global tc + tc = 0 + +@app.route('/startfreq/<freq>') +def freq(freq): + print(freq) + thread2 = Thread(target=playFunction, args=freq) + return("200") + +@app.route('/stopfreq/<freq2>') +def freq2(freq2): + global threadFlag + threadFlag = True + return("200") + +if __name__ == "__main__": + app.run(debug=True, host='0.0.0.0') + + + +
\ No newline at end of file |