Pulse Sensor Code

Hi Guys,

I have recently bought a Pulse sensor from SparkFun and it works fine. I coded it to display the BPM on the LCD I bought. It’s a 16x2 and the pulse sensor is running off 5V.

I get a reading when I use the Serial Plotter and the LCD displays numbers and variables, but they’re all gibberish. It displays a BPM of 105 and then suddenly jumps to 905 and so forth to on. I was wondering if anyone could help me.

I have attached my coding below (literally a copy and paste of the original version with a few exceptions).
My LCD wiring is as follows:
VSS - GND
VDD - 5V
VO - 10K potentiometer
RS - Digital Pin 12
RW - GND
E - Digital Pin 11
D4 - Digital Pin 5
D5 - Digital Pin 4
D6 - Digital Pin 3
D7 - Digital Pin 2
A - 5V
K - GND

Pulse_sensor___lcd_test.ino (7.54 KB)

try add a space in front and end of numbers or clear the line before writing

the 905 is probably 90 and the leftovers from previous reading

Try inserting after line 103:

lcd.print("     ") // 5 spaces
lcd.setCursor(1, 1);

Sorry, I'm new to programing with Arduino, What do you mean clear the line before writing?
And thank you so very much. I really appreciate the help.