Closed beatricebruno closed 2 years ago
Hello, do you have any error log for me?
Kevin
Basically we now think we figured out the library issue: we used the code in the example to create a library and we can now include it in the sketch. Can you confirm me this is the correct way to do it? Anyway now the problem is in the function "pushsafer", used in the void loop (). This is the message regarding the error:
C:\Users\maria\Desktop\polimi\informatica\arduino\app_push\app_push.ino: In function 'void loop()': app_push:112:43: error: no match for call to '(Pushsafer) (const char [14], WiFiClient&)' pushsafer(PushsaferKey, client);
So we assume the problem is either in the initialization of the function "pushsafer" or in the definition of the "client".
I'll send you the whole script, in case you need it:
//#include
// Pushsafer private or alias key
/WiFiClientSecure client;/ WiFiClient client; Pushsafer pushsafer(PushsaferKey, client);
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
PulseOximeter pox; uint32_t tsLastReport = 0; const int buzzer = 7; //buzzer connesso a pin 7 byte counter=0;
void onBeatDetected() { Serial.println("Beat!"); }
void setup()
{
//pushsafer.debug = true;
struct PushSaferInput input;
input.message = "Aiuto";
input.title = "Emergenza";
input.sound = "8";
input.vibration = "2";
input.icon = "5";
input.iconcolor = "#DB4035";
input.priority = "2";
//input.device = "a";
input.url = "https://www.pushsafer.com";
//input.urlTitle = "Open Pushsafer.com";
//input.time2live = "";
input.retry = "60";
input.expire = "60";
input.answer = "0";
pinMode(buzzer, OUTPUT); //lo faccio riconoscere come output
Serial.begin(115200);
Serial.print("Initializing pulse oximeter..");
lcd.begin(16,2);
lcd.print("Initializing...");
delay(3000);
lcd.clear();
// Initialize the PulseOximeter instance
// Failures are generally due to an improper I2C wiring, missing power supply
// or wrong target chip
if (!pox.begin()) {
Serial.println("FAILED");
for(;;);
} else {
Serial.println("SUCCESS");
}
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// Register a callback for the beat detection
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void loop() { // Make sure to call update as fast as possible pox.update(); if (millis() - tsLastReport > REPORTING_PERIOD_MS) { Serial.print("Heart rate:"); Serial.print(pox.getHeartRate()); Serial.print("bpm / SpO2:"); Serial.print(pox.getSpO2()); Serial.println("%"); //introduco le soglie di allarme if(pox.getHeartRate() > 100 || pox.getHeartRate() < 60){ Serial.print("WARNING! Heartbeat!"); } if(pox.getSpO2() < 92){ Serial.print("WARNING!"); }
lcd.clear();
lcd.setCursor(0,0);
if(pox.getHeartRate()<65 || pox.getHeartRate()>95){
lcd.print("!! "); //consiglia di fare un controllo
if(counter<4){
tone(buzzer, 550); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // stop sound...
delay(1000); //... per 1 sec
counter++;
}
} else if (pox.getHeartRate()>100){
lcd.print("TACHYCARDIA: "); //mex
if(counter<100){
tone(buzzer, 550); // Send 1KHz sound signal...
delay(100); // ...for 100 msec
noTone(buzzer); // stop sound...
delay(50); //... per 50ms
counter++;
pushsafer(PushsaferKey, client);
}
} else if (pox.getHeartRate()<60){
lcd.print("BRADYCARDIA: "); //mex
if(counter<100){
tone(buzzer, 550); // Send 1KHz sound signal...
delay(100); // ...for 100 msec
noTone(buzzer); // stop sound...
delay(50); //... per 50ms
counter++;
}
}
lcd.print("BPM: ");
lcd.print(pox.getHeartRate());
lcd.setCursor(0,1);
if(pox.getSpO2()<92 || pox.getSpO2()>90){
lcd.print("!! ");
if(counter<4){
tone(buzzer, 550); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // stop sound...
delay(1000); //... per 1 sec
counter++;
}
} else if (pox.getSpO2()<90){
lcd.print("HYPOXIA"); //mex
if(counter<100){
tone(buzzer, 550); // Send 1KHz sound signal...
delay(100); // ...for 100 msec
noTone(buzzer); // stop sound...
delay(50); //... per 50ms
counter++;
}
}
lcd.print("SpO2: ");
lcd.print(pox.getSpO2());
lcd.print("%");
tsLastReport = millis();
}
}
Thank you in advance!
Hi,
a working example you will find here: https://github.com/appzer/pushsafer-arduino-library/blob/master/examples/esp8266/sendEvent/sendEvent.ino
I'm not a pro with arduino, so i can't help you. Please visit a Arduino Board there you will find help.
Kevin
Hello! I am currently trying to build a pulse oximeter with an arduino nano and the idea was to make it sand a notification on my phone whether the values were dangerous! So I used the code of the example on your website but arduino IDE does not recognize the library, so I can’t use the function to send the notification…
Do you have any idea of why this is not working?
Thank you in advance!