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.
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.
// 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.
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.
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.
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)