Error: return-statement with no value, in function returning 'int' [-fpermissive]

this is my code program, does anyone know why I keep getting an error? the error message is like this:

C:\Users\Lenovo\OneDrive\Documents\Arduino\libraries\PulseSensorPlayground-master\src\PulseSensorPlayground.cpp: In member function 'int PulseSensorPlayground::getPulseAmplitude(int)':
C:\Users\Lenovo\OneDrive\Documents\Arduino\libraries\PulseSensorPlayground-master\src\PulseSensorPlayground.cpp:209:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
209 | return; // out of range.
| ^~~~~~
C:\Users\Lenovo\OneDrive\Documents\Arduino\libraries\PulseSensorPlayground-master\src\PulseSensorPlayground.cpp: In member function 'long unsigned int PulseSensorPlayground::getLastBeatTime(int)':
C:\Users\Lenovo\OneDrive\Documents\Arduino\libraries\PulseSensorPlayground-master\src\PulseSensorPlayground.cpp:216:5: error: return-statement with no value, in function returning 'long unsigned int' [-fpermissive]
216 | return; // out of range.
| ^~~~~~
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h> 
#include <ArduinoJson.h>   

const int PulseWire = 0;       
const int LED13 = 13;          
int Threshold = 550;          
                               
PulseSensorPlayground pulseSensor;  

// Initialize Wifi connection to the router
char ssid[] = "***";     // diisi nama wifi
char password[] = "***"; // diisi password wifi

// Initialize Telegram BOT
#define BOTtoken "5168512905:AAFpH1ltbhE_gh6O1qjYJLdN1RnjiJTC8tU" // diisi Token Bot (Dapat dari Telegram Botfather)

WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);

//Checks for new messages every 1 second.
int botRequestDelay = 1000;
unsigned long lastTimeBotRan;

void handleNewMessages(int numNewMessages) {

  Serial.println("handleNewMessages");
  Serial.println(String(numNewMessages));

  for (int i=0; i<numNewMessages; i++) {
    String chat_id = String(bot.messages[i].chat_id);
    String text = bot.messages[i].text;

    String from_name = bot.messages[i].from_name;
    if (from_name == "") from_name = "Guest";
    
    //Cek Detak Jantung Pasien
    if (text == "/detakjantung") {
        int myBPM = pulseSensor.getBeatsPerMinute();  
        if (pulseSensor.sawStartOfBeat()) {             
            String detak = "Detak Jantung Saat Ini: ";
            detak += int(myBPM);
            detak +=" BPM";                       
            Serial.println(myBPM);
            bot.sendMessage(chat_id,detak, "");
           }
         }
         
    //Cek Command untuk setiap aksi
    if (text == "/start") {
      String welcome = "Welcome  " + from_name + ".\n";
      welcome += "/detakjantung : Cek Detak Jantung Pasien\n";
      welcome += "/volumeinfus : Cek Volume Infus\n";
      welcome += "/kualitastidur : Cek Kualitas Tidur Pasien\n";
      bot.sendMessage(chat_id, welcome, "Markdown");
    }
  }
}

void setup() {   

  Serial.begin(9600);      
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(LED13);      
  pulseSensor.setThreshold(Threshold);   
   if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");  
  }
  client.setInsecure();

  // Set WiFi to station mode and disconnect from an AP if it was Previously
  // connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  // attempt to connect to Wifi network:
  Serial.print("Connecting Wifi: ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  Serial.print("Connecting...");
  
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
 int myBPM = pulseSensor.getBeatsPerMinute();  
 if (pulseSensor.sawStartOfBeat()) {            
 Serial.println("♥  A HeartBeat Happened ! "); 
 Serial.print("BPM: ");                       
 Serial.println(myBPM);                  
 }
  delay(20); 
    if (millis() > lastTimeBotRan + botRequestDelay)  {
    int numNewMessages = bot.getUpdates(bot.last_message_received + 1);

    while(numNewMessages) {
      Serial.println("got response");
      handleNewMessages(numNewMessages);
      numNewMessages = bot.getUpdates(bot.last_message_received + 1);
    }

    lastTimeBotRan = millis();
  }                  
}

The error is in the library code.

I updated the library and then the problem solved! Thank you for your answer.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.