Skip to content

Commit

Permalink
Buzzer support added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar-laxmi committed Feb 21, 2024
1 parent 1bfff59 commit c00f8f4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import threading
import time
import os
from gpiozero import Buzzer

from .models import heartAudio, lungAudio
from .forms import heartAudioForms, lungAudioForm
Expand All @@ -22,6 +23,8 @@
hr_show, rr_show = 60, 15 # Initialize the Heart Rate and Breadth Rate
current_mitral_valve_sound, current_aortic_valve_sound, current_pulmonary_valve_sound, current_tricuspid_valve_sound, current_erb_valve_sound, current_lungs_sound, current_bowel_sound = None, None, None, None, None, None, None

buzzer = Buzzer(17)

speakers = sc.all_speakers()

try:
Expand Down Expand Up @@ -98,9 +101,15 @@ def heartUpdate(request):
if request.method == 'POST':
if 'hr_plus' in request.POST:
hr_show += 1
buzzer.on()
time.sleep(0.5)
buzzer.off()
print('\nHeart Rate updated to: {}'.format(hr_show))
elif 'hr_minus' in request.POST:
hr_show -= 1
buzzer.on()
time.sleep(0.5)
buzzer.off()
print('\nHeart Rate updated to: {}'.format(hr_show))
else:
hr_show += 0
Expand All @@ -126,9 +135,15 @@ def breathUpdate(request):
if request.method == 'POST':
if 'rr_plus' in request.POST:
rr_show += 1
buzzer.on()
time.sleep(0.5)
buzzer.off()
print('\nBreath Rate updated to: {}'.format(rr_show))
elif 'rr_minus' in request.POST:
rr_show -= 1
buzzer.on()
time.sleep(0.5)
buzzer.off()
print('\nBreath Rate updated to: {}'.format(rr_show))
else:
rr_show += 0
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cffi==1.16.0
channels==4.0.0
charset-normalizer==3.3.2
click==8.1.7
colorzero==2.0
comm==0.2.1
contourpy==1.2.0
cycler==0.12.1
Expand All @@ -34,6 +35,7 @@ executing==2.0.1
Flask==3.0.0
Flask-Caching==2.1.0
fonttools==4.47.0
gpiozero==2.0.1
h11==0.14.0
idna==3.6
importlib-metadata==7.0.1
Expand Down
8 changes: 8 additions & 0 deletions virtualenv/bin/pinout
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/Users/kumarlaxmikant/Desktop/Visual_Studio/Auscultation-Simulator-Application/virtualenv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from gpiozerocli.pinout import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
8 changes: 8 additions & 0 deletions virtualenv/bin/pintest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/Users/kumarlaxmikant/Desktop/Visual_Studio/Auscultation-Simulator-Application/virtualenv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from gpiozerocli.pintest import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

0 comments on commit c00f8f4

Please sign in to comment.