Arduino Hearth Monitor

I want to make this ting: How to use LCD to Monitor pulse using arduino - YouTube

I alredy make all sets and when I want to verify and upload code I recive this error:
,,class hardwareserial' has no member named ''setcursor''.

Eror Code Arduino: 1.8.17 Hourly Build 2021/09/06 02:33 (Windows 10), Placă"Arduino Uno"

D:\Eletronica\Proiect CEX\heartsensorwith_lcd\heartsensorwith_lcd.ino: In function 'void loop()':

heartsensorwith_lcd:38:11: error: 'class HardwareSerial' has no member named 'setCursor'

Serial.setCursor(0,0);

       ^~~~~~~~~

heartsensorwith_lcd:40:11: error: 'class HardwareSerial' has no member named 'setCursor'

Serial.setCursor(0,1);

       ^~~~~~~~~

heartsensorwith_lcd:42:11: error: 'class HardwareSerial' has no member named 'setCursor'

Serial.setCursor(0,1);

       ^~~~~~~~~

exit status 1

'class HardwareSerial' has no member named 'setCursor'

All my code:

/*
This example will show you how to use the KY-039 heart bear sensor.
Its a simple basic heart beat monitor with a LCD1602A. In this example i did not use a I2C for those who dont have it.
*/
#include <Wire.h>
#include <LiquidCrystal.h>
//#include <LiquidCrystal_I2C.h>//uncomment when using a I2C

//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);// Uncomment when using a I2C
//make sure you set the right adress. here are the most common ones.
//PCF8574 = 0x20, PCF8574A = 0x38, PCF8574AT = 0x3F.

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
double alpha=0.75;
int period=20;
double refresh=0.0;

void setup(void)
{
pinMode(A0,INPUT);

// lcd.backlight(); //Uncomment when using a I2C
Serial.begin(9600);
}

void loop(void)
{
static double oldValue=0;
static double oldrefresh=0;

int beat=analogRead(A0);
Serial.println(beat);
double value=alpha*oldValue+(0-alpha)*beat;
refresh=value-oldValue;

Serial.setCursor(0,0);
Serial.print(" Heart Monitor ");
Serial.setCursor(0,1);
Serial.print(" ");
Serial.setCursor(0,1);
Serial.print(beat/10);
oldValue=value;
oldrefresh=refresh;
delay(period*10);

}

Please help me

Please remember to use code tags when posting code.

(You maybe also want to review the topic title)

I upload again the code and working but now on lcd dont apear anithing just light. What can I do?

The compiler is correct in what it says

You have changed the code in an attempt to output to Serial rather than an LCD

You have no code there to display anything on an LCD.
Perhaps the YT video had different code

It did, and the name of the associated sketch is
heartsensorwith_lcd.ino which gives a very big clue

Couldn't resist it.
I thought this was to do with detecting embers flying out of the fireplace.

2 Likes

I finish the project Monday. Thanks for answers!

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