well it wasn't the last one
This commit is contained in:
parent
99c116fc87
commit
00b5d65cbb
17
main8.cpp
17
main8.cpp
|
|
@ -11,7 +11,7 @@ const int BPM_MAX = 110; // Maximum Normal BPM
|
|||
const int BPM_TACHYCARDIA = 40; // Minimum BPM for Tachycardia
|
||||
const int BPM_BRADYCARDIA = 140; // Maximum BPM for Bradycardia
|
||||
const int SAMPLE_INTERVAL_MS = 1000; // Sampling every 1s
|
||||
const int THRESHOLD_CARDIAC_ARREST = 5;
|
||||
const int THRESHOLD_CARDIAC_ARREST = 2;
|
||||
|
||||
|
||||
// === Initialize random generator ===// === Simulate heart signal from sensor ===
|
||||
|
|
@ -22,17 +22,17 @@ int generateRandomHeartRate() {
|
|||
|
||||
// === Simulate buzzer activation ===
|
||||
void activateBuzzer() {
|
||||
std::cout << " Buzzer active (ALERTE CARDIAQUE)!" << std::endl;
|
||||
std::cout << " Buzzer activated (CARDIAC ALERT)!" << std::endl;
|
||||
}
|
||||
|
||||
// === Simulate vibration motor activation ===
|
||||
void activateVibration() {
|
||||
std::cout << " Vibreur active (ALERTE CARDIAQUE)!" << std::endl;
|
||||
std::cout << " Vibration activated (CARDIAC ALERT)!" << std::endl;
|
||||
}
|
||||
|
||||
// === Simulate Bluetooth transmission ===
|
||||
void sendMessageBluetooth(bool urgence) {
|
||||
std::cout << " Message Bluetooth envoye: " << (urgence ? "TRUE (urgence)" : "FALSE (normal)") << std::endl;
|
||||
std::cout << " Message Bluetooth send : " << (urgence ? "TRUE (urgence)" : "FALSE (normal)") << std::endl;
|
||||
}
|
||||
|
||||
// send avg bvpm of the last minute
|
||||
|
|
@ -73,24 +73,27 @@ int main() {
|
|||
if (bpm < BPM_MIN && bpm > BPM_TACHYCARDIA){
|
||||
std::cout << " [BRADYCARDIA]" << std::endl;
|
||||
activateVibration();
|
||||
i=0;
|
||||
|
||||
} else if(bpm < BPM_BRADYCARDIA && bpm > BPM_MAX) {
|
||||
std::cout << " [TACHYCARDIA]" << std::endl;
|
||||
activateVibration();
|
||||
i=0;
|
||||
|
||||
}else if(bpm < BPM_MAX && bpm > BPM_MIN){
|
||||
std::cout << " [NORMAL]" << std::endl;
|
||||
i=0;
|
||||
|
||||
} else if (bpm < BPM_TACHYCARDIA){
|
||||
if (i>=THRESHOLD_CARDIAC_ARREST && lastBPM < BPM_TACHYCARDIA){
|
||||
if (i=THRESHOLD_CARDIAC_ARREST && lastBPM < BPM_TACHYCARDIA){
|
||||
i=0;
|
||||
std::cout << " \n !! Number = 5 [HEART ATTACK]" << std::endl;
|
||||
std::cout << " \n !! Number = 2 [HEART ATTACK]" << std::endl;
|
||||
activateBuzzer();
|
||||
activateVibration();
|
||||
sendMessageBluetooth(true);
|
||||
}else{
|
||||
std::cout << " \n !! Low BPM, emergency alert if number gets to 5: "<<i << std::endl;
|
||||
i+=1;
|
||||
std::cout << " \n !! Low BPM, emergency alert if number gets to 2: "<<i << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue