Giter Site home page Giter Site logo

Comments (3)

appzer avatar appzer commented on June 1, 2024

Hello, do you have any error log for me?

Kevin

from pushsafer-arduino-library.

beatricebruno avatar beatricebruno commented on June 1, 2024

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.h>

#include <LiquidCrystal.h>
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <FTPClient_Generic.h>
#include <FTPClient_Generic.hpp> //per wifiNINA

//#include <dscKeybusInterface.h> //per pushsafer

// Pushsafer private or alias key
#define PushsaferKey "XXXXXXXXXXXXX"

/WiFiClientSecure client;/
WiFiClient client;
Pushsafer pushsafer(PushsaferKey, client);

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

#define REPORTING_PERIOD_MS 1000

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!

from pushsafer-arduino-library.

appzer avatar appzer commented on June 1, 2024

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

from pushsafer-arduino-library.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.