Error when I try to upload, Arduino Nano

Hi,
I'm trying to make a device that reads a person's pulse from the navel of the finger, originally it was supposed to be a pulse oximeter. When I want to upload the code I get the following error:
"Arduino: 1.8.16 (Windows 10), Board: "Arduino Nano, ATmega328P"

C:\Users\corda\AppData\Local\Temp\ccR5pu2I.ltrans0.ltrans.o: In function `begin':

C:\Program Files (x86)\Arduino\libraries\PulseSensorPlayground-master\src/PulseSensorPlayground.cpp:56: undefined reference to `PulseSensorPlayground::UsingInterrupts'

C:\Program Files (x86)\Arduino\libraries\PulseSensorPlayground-master\src/PulseSensorPlayground.cpp:57: undefined reference to `PulseSensorPlaygroundSetupInterrupt()'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"
I looked where it references the error but I didn't understand what I need to see or do.
If someone wants to help me, I leave the code below, probably I wrote something, I mention that I'm at the beginning of coding, and my relationship with programming is not the best.
Have a nice day!

#include <Wire.h> 
#include <PulseSensorPlayground.h>
#include <SPI.h>
#include <TFT.h>
#include <SD.h>

//Definire pini

#define USE_ARDUINO_INTERRUPTS true // Configurare întreruperi de nivel scăzut pentru cele mai exacte calcule BPM.
#define cs   10
#define dc   9
#define rst  8


TFT TFTscreen = TFT(cs, dc, rst);

char sensorPrintout[4];
float p = 3.1415926;

//Variabile
const int PulseWire = 0; //Senzor puls conectat la pinul analog A0
const int LED13 = 13;
int Threshold = 550; //Determinca care semnal trebuie sa "conteze ca un ritm" si care trebuie ignorat



PulseSensorPlayground pulseSensor; // Creează o instanță a obiectului PulseSensorPlayground numit "pulseSensor".
void setup() {
  
   //Initializare 1.8" TFT
  TFTscreen.begin();
  TFTscreen.background(0, 0, 0);
  TFTscreen.stroke(255, 255, 255);
  TFTscreen.setTextSize(2);
  TFTscreen.text("BPM: ",0 ,0);
  TFTscreen.setTextSize(5);
  


  // Configurara Senzor Puls, atribuindu-i variabilele noastre.
  pulseSensor.analogInput(PulseWire);
  pulseSensor.blinkOnPulse(LED13); // Clipește în mod automat și magic LED-ul lui Arduino cu bătăile inimii.

  // Verificam de două ori dacă obiectul "pulseSensor" a fost creat și a "început" să vadă un semnal.
  if (pulseSensor.begin()) {
  Serial.println("We created a pulseSensor Object !"); //Aceasta se imprimă o singură dată la pornirea Arduino sau la resetarea Arduino.
  TFTscreen.text("Heart Rate Monitor", 0, 0);
  }
}

void loop(){
  int myBPM = pulseSensor.getBeatsPerMinute(); //Apelarea funcției asupra obiectului nostru pulseSensor care returnează BPM sub forma unui "int".
  //"myBPM" păstrează acum această valoare BPM.
  if(pulseSensor.sawStartOfBeat()) { //Testeaza în mod constant pentru a vedea dacă "s-a întâmplat o bătaie".
    Serial.println("♥ A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
    Serial.print("BPM: "); // Print phrase "BPM: "
    Serial.println(myBPM); // Print the value inside of myBPM.
    TFTscreen.text("A HeartBeat Happened ! ", 0, 0); 
    TFTscreen.text("BPM: ", 0, 0);
    TFTscreen.text(myBPM, 0, 0);
  }
  delay(20); //considerată cea mai bună practică într-o schiță simplă.
}

This is not an upload error, but a compilation error. You seem to be missing one or more libraries. For starters, try to install the following library.

I get the same error

Hmm, I did not look at the error messages closely enough. This may be a problem with the library itself.

[edit] I found this in the source:

  NOTE: Every Sketch that uses the PulseSensor Playground
  must define the variable USE_ARDUINO_INTERRUPTS *before* including
  PulseSensorPlayground.h. If you don't, you will get a compiler error
  about "undefined reference to `PulseSensorPlayground::UsingInterrupts".

This is probably explained in the library documentation.

It works, thank you very much and I didn't expect that #define to be causing errors.

It would be in every library example sketch...

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