aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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__":