aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhruv Venkataraman2022-10-03 00:01:29 -0400
committerDhruv Venkataraman2022-10-03 00:01:29 -0400
commit05ef2780215f1348b5ea326a909ebd6b1d51edf8 (patch)
treef704fb5ee725712857275e67794b8e6c92952d55
parent3a3e5874f6ecd5f157dba2c41243502b411e2beb (diff)
whee
-rw-r--r--backend/app.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/app.py b/backend/app.py
index b638ba6..4382c7a 100644
--- a/backend/app.py
+++ b/backend/app.py
@@ -12,6 +12,7 @@ def playFunction(freq):
os.system("beep -f"+ freq+" -l 100000")
#print("beep -f %f" % (freq))
+thread2 = 0
tc = 0
@app.before_first_request
def activate_job():
@@ -21,6 +22,7 @@ def activate_job():
@app.route('/startfreq/<freq>')
def freq(freq):
global threadFlag
+ global thread2
threadFlag = False
print(freq)
thread2 = Thread(target=playFunction, args=(freq,))
@@ -30,7 +32,9 @@ def freq(freq):
@app.route('/stopfreq/<freq2>')
def freq2(freq2):
global threadFlag
+ global thread2
threadFlag = True
+ thread2.stop()
return("200")
if __name__ == "__main__":