heart beat mornitoring

I downloaded a code which best suits a heart beat project in school. I have debugged some of the error encountered, but still facing some challenges with the code.This is Error encountered after debugging original code, and in attached this the code.

<Arduino: 1.6.5 (Windows 8.1), Board: “Arduino Uno”

HEART_BEAT_MORNITORING_CODE_:9: error: ‘number’ does not name a type
In file included from C:\Program Files\arduino-1.6.5\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,
from HEART_BEAT_MORNITORING_CODE_.ino:3:
C:\Program Files\arduino-1.6.5\hardware\arduino\avr\cores\arduino/Arduino.h:202:17: error: expected unqualified-id before numeric constant
#define TIMER2 6
^
HEART_BEAT_MORNITORING_CODE_.ino:63:5: note: in expansion of macro ‘TIMER2’
C:\Program Files\arduino-1.6.5\hardware\arduino\avr\cores\arduino/Arduino.h:202:17: error: expected unqualified-id before numeric constant
#define TIMER2 6
^
HEART_BEAT_MORNITORING_CODE_.ino:63:5: note: in expansion of macro ‘TIMER2’
‘number’ does not name a type

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.

HEART_BEAT_MORNITORING_CODE_.ino (8.2 KB)

The code you uploaded is a bit of a train wreck, you’ve included LiquidCrystal 3 times?

#include <LiquidCrystal.h>

Lines 140 to 142:

// Calculates the ranges of the zones based on the inputted age and prints the zone
number to the second row of the LCD shield
void LCDdisplay(int ageDisplay, int BPMDisplay) {

Surely line 141 needs something to tell the compiler to ignore it.

Lines 176 to 180:

int getage(); {
  lcd.begin(16, 2);
  lcd.print(" Enter your age: ");
  while (flag); {

Have you noticed that setup() and loop() functions do not have a ; after the ()'s? Why does your function have one?

Why does your while statement have a ;?

You REALLY should put EVERY { on a line BY ITSELF.
You REALLY should put EVERY } on a line BY ITSELF.
You REALLY should learn what Tools + Auto Format does. Wonders, that is, for you poorly indented code.

Really? This is what I get:

Arduino: 1.8.1 (Windows 7), Board: "Arduino Duemilanove or Diecimila, ATmega328"

C:\Users\emarshall\Desktop\HEART_BEAT_MORNITORING_CODE_\HEART_BEAT_MORNITORING_CODE_.ino: In function 'void loop()':

HEART_BEAT_MORNITORING_CODE_:31: error: 'LCDBPM' was not declared in this scope

     LCDBPM(BPM); // Function to print the BPM on the LCD screen

               ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,

                 from sketch\HEART_BEAT_MORNITORING_CODE_.ino.cpp:1:

C:\Users\emarshall\Desktop\HEART_BEAT_MORNITORING_CODE_\HEART_BEAT_MORNITORING_CODE_.ino: At global scope:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:210:17: error: expected unqualified-id before numeric constant

 #define TIMER2  6

                 ^

C:\Users\emarshall\Desktop\HEART_BEAT_MORNITORING_CODE_\HEART_BEAT_MORNITORING_CODE_.ino:68:5: note: in expansion of macro 'TIMER2'

 ISR(TIMER2 COMPA vect) { //Triggered when Timer2 counts to 124

     ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:210:17: error: expected unqualified-id before numeric constant

 #define TIMER2  6

                 ^

C:\Users\emarshall\Desktop\HEART_BEAT_MORNITORING_CODE_\HEART_BEAT_MORNITORING_CODE_.ino:68:5: note: in expansion of macro 'TIMER2'

 ISR(TIMER2 COMPA vect) { //Triggered when Timer2 counts to 124

     ^

exit status 1
'LCDBPM' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

There sure are a lot of:

#include <LiquidCrystal.h>

in there.

You are right, I also get that error. However that's just an ordering issue or use of a prototype as the function exists further down. There is quite a few more serious issue as PaulS pointed out.

this code has a lot work then, friend where do i start from, how can i get it right ?
does it mean liquid crystal should be eliminated?

Yes it has a lot of work.

Id start with PaulS’ post. Look at what he said regarding semicolons after function definitions. ie

This is the correct form:

void func()
{
}

and not this:

void func();
{
}

I’d also put all preprocessor directives at the top of your file. That is, any #includes #defines etc.

You only need to include a header file once, so you can remove the other 2 uses of #include <LiquidCrystal.h>.

Have corrected the setup() and loop() functions by placing a ; after the ()'s.
still picking up some few errors.

<
:7: error: ‘number’ does not name a type
:19: error: expected unqualified-id before ‘{’ token
:23: error: expected unqualified-id before ‘{’ token ‘number’ does not name a type

what does it mean ( does not name a type) & (expected unqualified-id before)

Have corrected the setup() and loop() functions by placing a ; after the ()'s.

They were correct; you f**ked them up. The other ones were wrong; they are still wrong.

any assistance on the heart beat code

any assistance on the heart beat code

The code you haven't fixed? Or, if you did, that you haven't posted?

No.