'HIGH' was not declared in this scope

Hello, everyone! I am shalekberli. I can't find my problem issue :frowning: Please find my issue and write an answer.
But my code is very long. That's why Arduino don't agree for I write my code. I write the a piece of the issue. Here is:
void onDraw(unsigned long currentTime) {
if(!isDisplayTime(currentTime)) // Do not re-draw at every tick
return;

if(displayMode == DISPLAY_MODE_START_UP) {
drawStartUp();
}
else if(displayMode == DISPLAY_MODE_CLOCK) {
if(isClicked == LOW) { // User input received
startEmergencyMode();
setPageChangeTime(0); // Change mode with no page-delay
setNextDisplayTime(currentTime, 0); // Do not wait next re-draw time
}
else {
drawClock();

if(isPageChangeTime(currentTime)) { // It's time to go into idle mode
startIdleMode();
setPageChangeTime(currentTime); // Set a short delay
}
setNextDisplayTime(currentTime, CLOCK_DISP_INTERVAL);
}
}
else if(displayMode == DISPLAY_MODE_EMERGENCY_MSG) {
if(findNextEmerMessage()) {
drawEmergency();
emgCurDisp++;
if(emgCurDisp >= EMG_COUNT_MAX) {
emgCurDisp = 0;
startMessageMode();
}
setNextDisplayTime(currentTime, EMERGENCY_DISP_INTERVAL);
}
// There's no message left to display. Go to normal message mode.
else {
startMessageMode();
//setPageChangeTime(0);
setNextDisplayTime(currentTime, 0); // with no re-draw interval
}
}
else if(displayMode == DISPLAY_MODE_NORMAL_MSG) {
if(findNextNormalMessage()) {
drawMessage();
msgCurDisp++;
if(msgCurDisp >= MSG_COUNT_MAX) {
msgCurDisp = 0;
startClockMode();
}
setNextDisplayTime(currentTime, MESSAGE_DISP_INTERVAL);
}
// There's no message left to display. Go to clock mode.
else {
startClockMode();
setPageChangeTime(currentTime);
setNextDisplayTime(currentTime, 0); // with no re-draw interval
}
}
else if(displayMode == DISPLAY_MODE_IDLE) {
if(isClicked == LOW) { // Wake up watch if there's an user input
startClockMode();
setPageChangeTime(currentTime);
setNextDisplayTime(currentTime, 0);
}
else {
drawIdleClock();
setNextDisplayTime(currentTime, IDLE_DISP_INTERVAL);
}
}
else {
startClockMode(); // This means there's an error
}

isClicked = HIGH;
} // End of onDraw()

My guess would be a mismatched { } brace pair in your function onDraw.

Use the auto format code option in the IDE and check your brace indentation.

Also please learn to use [​code][​/code] tags when posting code on the forums. You can automatically insert them with the </> button on the menu bar.

Edit: Either that or the problem lies elsewhere. How and where is variable “isClicked” declared?

What kind of variable is 'isClicked' ? Please attach the whole code and the error. Also try replacing HIGH with 1

I can't send all of the code because the site doesn't allow to write code up 9000 words

So attach a file to a post

here it is:

bitmap.cpp (28.7 KB)

Who can find it? Write pls

Compiling fine here...

Sketch uses 20850 bytes (67%) of program storage space. Maximum is 30720 bytes.
Global variables use 836 bytes (40%) of dynamic memory, leaving 1212 bytes for local variables. Maximum is 2048 bytes.

I had to guess what you'd put in bitmap.h and fake some variables...

//#include "bitmap.h"
void* IMG_indicator_msg;
void* IMG_indicator_emg;
void* IMG_logo_24x24;
void* bitmap_array[0];

#define ICON_ARRAY_SIZE 0

Why's it uploaded as a cpp when it's clearly an ino containing setup() and loop()?
Perhaps I'm missing something.

Yes your are right. But I find bitmap.h library in .cpp file. Who can find issue? Write below

Post the error message.

'HIGH' was not declared in this scope
This is error message :frowning:

No.
All the error message.
There is even a handy control to copy it for you.

Nope, not missing anything. Renamed as cpp and added a valid ino module to the sketch.

Compiling...

Arduino: 1.8.12 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

bitmap.cpp:172:18: error: 'HIGH' was not declared in this scope

 bool isClicked = HIGH;

                  ^~~~

sketch\bitmap.cpp: In function 'void setup()':

bitmap.cpp:177:3: error: 'Serial' was not declared in this scope

   Serial.begin(9600);    // WARNING: Do not enable this if there is not enough memory

   ^~~~~~

sketch\bitmap.cpp:177:3: note: suggested alternative: 'BTSerial'

   Serial.begin(9600);    // WARNING: Do not enable this if there is not enough memory

   ^~~~~~

   BTSerial

bitmap.cpp:184:3: error: 'init_emg_array' was not declared in this scope

   init_emg_array();

   ^~~~~~~~~~~~~~


...FAR MORE ERRORS THAN I CAN POST HERE IN THE FORUM LIMIT...


     ^~~~~~~~~~~~~~

bitmap.cpp:584:15: error: 'HIGH' was not declared in this scope

   isClicked = HIGH;

               ^~~~

sketch\bitmap.cpp: In function 'bool isDisplayTime(long unsigned int)':

bitmap.cpp:595:20: error: 'LOW' was not declared in this scope

   if (isClicked == LOW) {

                    ^~~

bitmap.cpp:596:5: error: 'delay' was not declared in this scope

     delay(500);

     ^~~~~

sketch\bitmap.cpp: In function 'void drawStartUp()':

bitmap.cpp:747:5: error: 'u8g_prepare' was not declared in this scope

     u8g_prepare();

     ^~~~~~~~~~~

sketch\bitmap.cpp:747:5: note: suggested alternative: 'u8g_Delay'

     u8g_prepare();

     ^~~~~~~~~~~

     u8g_Delay

sketch\bitmap.cpp: In function 'void drawEmergency()':

bitmap.cpp:778:5: error: 'u8g_prepare' was not declared in this scope

     u8g_prepare();

     ^~~~~~~~~~~

sketch\bitmap.cpp:778:5: note: suggested alternative: 'u8g_Delay'

     u8g_prepare();

     ^~~~~~~~~~~

     u8g_Delay

bitmap.cpp:783:5: error: 'drawIcon' was not declared in this scope

     drawIcon(centerX - 8, centerY - 20, icon_num);

     ^~~~~~~~

sketch\bitmap.cpp: In function 'void drawMessage()':

bitmap.cpp:811:5: error: 'u8g_prepare' was not declared in this scope

     u8g_prepare();

     ^~~~~~~~~~~

sketch\bitmap.cpp:811:5: note: suggested alternative: 'u8g_Delay'

     u8g_prepare();

     ^~~~~~~~~~~

     u8g_Delay

bitmap.cpp:816:5: error: 'drawIcon' was not declared in this scope

     drawIcon(centerX - 8, centerY - 20, icon_num);

     ^~~~~~~~

sketch\bitmap.cpp: In function 'void drawClock()':

bitmap.cpp:841:5: error: 'u8g_prepare' was not declared in this scope

     u8g_prepare();

     ^~~~~~~~~~~

sketch\bitmap.cpp:841:5: note: suggested alternative: 'u8g_Delay'

     u8g_prepare();

     ^~~~~~~~~~~

     u8g_Delay

bitmap.cpp:877:7: error: 'showTimePin' was not declared in this scope

       showTimePin(centerY, centerY, 0.1, 0.4, iHour * 5 + (int)(iMinutes * 5 / 60));

       ^~~~~~~~~~~

bitmap.cpp:909:7: error: 'showTimePin' was not declared in this scope

       showTimePin(centerX, centerY, 0.1, 0.5, iHour * 5 + (int)(iMinutes * 5 / 60));

       ^~~~~~~~~~~

sketch\bitmap.cpp: In function 'void drawIdleClock()':

bitmap.cpp:924:5: error: 'u8g_prepare' was not declared in this scope

     u8g_prepare();

     ^~~~~~~~~~~

sketch\bitmap.cpp:924:5: note: suggested alternative: 'u8g_Delay'

     u8g_prepare();

     ^~~~~~~~~~~

     u8g_Delay

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

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

I think the OP need to explain exactly what they are trying to do.

I think .cpp file is in the .ino file

arduino.PNG

shalekberli:
I think .cpp file is in the .ino file

No.

If it is a .cpp file, you're missing "#include <Arduino.h>"

But this all seems very confused.

What's in the .ino file?

What I do? Who can find? PLS write. Look png pls TheMemberFormely. bitmap.ino - bitmap.cpp

What is in the .ino file?

shalekberli:
I think .cpp file is in the .ino file

A .cpp file certainly is NOT the same as a .ino.
The IDE performs completely different steps when compiling each.
You need to explain what you are trying to achieve, and what the structure of your project is.

  1. Take the bitmap.cpp file you posted here.
  2. Open it in Windows Notepad.
  3. Select all and copy it to the clipboard.
  4. Create a new sketch (.ino) file in Arduino IDE.
  5. Select all of the new template sketch provided (setup and loop) and delete them.
  6. Paste in the bitmap.cpp from the clipboard.
  7. Compile it.