Problems with PulseSensor_Playground libraries

I'm trying to use the bpm to serial monitor example in pulsesensor library, i edited it to upload to an i2c lcd but i keep getting this errorC:\Users\Wallie\AppData\Local\Temp\ccpmQpEd.ltrans0.ltrans.o: In function begin': c:\Users\Wallie\Documents\Arduino\libraries\PulseSensor_Playground\src/PulseSensorPlayground.cpp:55: undefined reference to PulseSensorPlayground::UsingInterrupts'
c:\Users\Wallie\Documents\Arduino\libraries\PulseSensor_Playground\src/PulseSensorPlayground.cpp:56: undefined reference to `PulseSensorPlaygroundSetupInterrupt()'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

THIS IS MY CODE

```
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <PulseSensorPlayground.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

const int PulseWire = 0;
const int LED = LED_BUILTIN;
int Threshold = 550;

PulseSensorPlayground pulseSensor;

void setup() {
  lcd.begin(); // initialize the lcd 
  Serial.begin(9600);
  
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(LED);
  pulseSensor.setThreshold(Threshold);

  if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");
    lcd.print("PulseSensor Ready");
  }
}

void loop() {
  if (pulseSensor.sawStartOfBeat()) {
    int myBPM = pulseSensor.getBeatsPerMinute();
    
    Serial.println("♥ A HeartBeat Happened !");
    Serial.print("BPM: ");
    Serial.println(myBPM);
    
    lcd.clear();
    lcd.setCursor(0,0); 
    lcd.print("Heartbeat detected");
    lcd.setCursor(0,1); 
    lcd.print("BPM: ");
    lcd.print(myBPM);
  }

  delay(20);
}

did unedited version worked?

btw: if you want to show your code place it between code-tags, not just as plain text. edit your post.

I'm new here, i'm sorry can you help me with the code tag. Also yes the un edited version of the example works

Please read How to get the best out of this forum.

Not sure why you think that this relates to "Avrdude, stk500, Bootloader issues". You have a compilation / linker problem; hence moved to a more suitable section on the forum.

My apologies🙏🏼

@slackinversion

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

1 Like

provide the link to

pls.

which pin is this? what board are you using?

one line is missing

#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.

and my LCD lib need such initialization:

lcd.init(); // initialize the lcd 

now it compiles without errors.

Its a nano

#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <PulseSensorPlayground.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

const int PulseWire = 0;
const int LED = LED_BUILTIN;
int Threshold = 550;

PulseSensorPlayground pulseSensor;

void setup() {
  lcd.init(); // initialize the lcd
  Serial.begin(9600);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Heartbeat detected");
  lcd.setCursor(0, 1);
  lcd.print("BPM: ");

  pulseSensor.analogInput(PulseWire);
  pulseSensor.blinkOnPulse(LED);
  pulseSensor.setThreshold(Threshold);

  if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");
    lcd.print("PulseSensor Ready");
  }
}

void loop() {
  if (pulseSensor.sawStartOfBeat()) {
    int myBPM = pulseSensor.getBeatsPerMinute();

    Serial.println("♥ A HeartBeat Happened !");
    Serial.print("BPM: ");
    Serial.println(myBPM);

    lcd.setCursor(5, 1);
    lcd.print(myBPM);
    lcd.print("   ");
  }

  delay(100);
}
1 Like

It compiles perfectly, Thanks alot :heart:

1 Like

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