r/ArduinoProjects • u/Tilpants • May 26 '24
I'm unsure why I have these characters...
Hi everyone,
I'm putting together a heart beat monitor using the PulseSensor and an Arduino Uno, plus some 3D printed bits and pieces to package it.
At the moment, I have it working but it's displaying these weird characters after the BPM are displayed, plus an extra word.
Here is the sketch:
"
"
```cpp
#define USE_ARDUINO_INTERRUPTS true // Set-up low-level interrupts for most acurate BPM math
#include <PulseSensorPlayground.h> // Includes the PulseSensorPlayground Library
#include <LiquidCrystal.h> // Includes LCD Library
const int PulseWire = 0; // 'S' Signal pin connected to A0
const int LED13 = 13; // The on-board Arduino LED
int Threshold = 530; // Determine which Signal to "count as a beat" and which to ignore
LiquidCrystal lcd(12,11,5,4,3,2);
PulseSensorPlayground pulseSensor; // Creates an object
void setup() {
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16,2);
lcd.clear();
// Configure the PulseSensor object, by assigning our variables to it
pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13); // Blink on-board LED with heartbeat
pulseSensor.setThreshold(Threshold);
// Double-check the "pulseSensor" object was created and began seeing a signal
if (pulseSensor.begin()) {
Serial.println("PulseSensor object created!");
}
}
void loop() {
int myBPM = pulseSensor.getBeatsPerMinute(); // Calculates BPM
// Print a message to the LCD.
lcd.print(" Heart Rate");
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print("BPM: ");
lcd.println(myBPM);
if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if a beat happened
Serial.println("♥ A HeartBeat Happened ! "); // If true, print a message
Serial.print("BPM: ");
Serial.println(myBPM); // Print the BPM value
}
delay(20);
}
```
Would anyone know why this is happening?
Thanks!
0
Upvotes
0
u/xebzbz May 26 '24
Maybe, lcd.begin is missing? How do you supply the length of the row?
https://github.com/arduino-libraries/LiquidCrystal/blob/master/docs/api.md