Closed ArmanPixel82 closed 2 years ago
I find it easier to just move the bitmap to another file. In Arduino create another tab (or create a new file in your project's directory) and call it something like "bitmaps.h". Then in your main code, at the top, add this line (somewhere before setup()
) to include this new file:
#include "bitmaps.h"
You can now put your bitmaps into the data.h
file. You need the ifndef
, define
and endif
to prevent the file from being included multiple times (once by use and once by the Arduino IDE during compiling):
#ifndef H_BITMAPS
#define H_BITMAPS
const unsigned char myBitmap [] PROGMEM = {
0x00, 0x01, 0x00, etc.
};
#endif
I was considering to define the bitmaps array at the beginning of code, However the codes of bitmaps are at the end of the code to make the code cleaner and easier to read. but I didn't know to how define these kind of arrays.
P.S: I'm doing this, because I have lots of bitmaps in my code and I have to scroll a lot to reach my main code. I had done this similar in BASCOM AVR but I'm not able to do this in Arduino.