I am hoping someone can help me as I am pulling my hair out trying to figure this out and have tried following the limited information I can find about this online but like a lot of the information the steps given are not always complete which makes trying to figure something out as a novice really frustrating. Been hours at it so far...
In the Adafruit SSD1306 library used for driving a OLED there is a logo specified in the Adafruit_SSD1306.cpp file which shows the Adafruit logo on OLED switch on. I have used software to convert a 128 x 64 8 bit bitmap to hex code but no matter where I place it it throws up a error or errors when being verified.
I have tried every which way such as replacing everything between the following with the generated logo hex code:
I then tried replacing the hex code that came after #if (SSD1306_LCDHEIGHT == 64) but it said I had too many characters which was probably true as there was considerably more characters in my logo than what was there in the 64 section.
Do I need to change anything in this line of code static uint8_t buffer[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8]?
I would be most grateful if someone could please tell me exactly where I am meant to place my logo hex code and if I need to change anything else for this to work because as I say I really am brand new to the Arduino and code of any description and trying to learn with practical examples but this bit is really over my head and would love to have my logo rather than Adafruits in my first Arduino project.
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).
belfastrab:
Do I need to change anything in this line of code static uint8_t buffer[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8]?
Probably not. buffer is being sized to fit the entire display. If your logo is larger than that it's just not going to work no matter what. If so, you need to make the logo smaller so it will fit on the display.
Ok well there is a couple of different ways according to various message boards of doing this both of which haven't worked for me so will do my best to show what I have done and then the errors returned for each attempt.
First attempt was to replace everything below #if (SSD1306_LCDHEIGHT == 64) until it's closing #endif leaving everything else as is
It returned the following error:
/tmp/826097935/custom/Adafruit_SSD1306_64/Adafruit_SSD1306.cpp:141:1: error: too many initializers for 'uint8_t [1024] {aka unsigned char [1024]}'
};
^
exit status 1
Second attempt was to replace everything between static uint8_t buffer[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8] = { and it's closing "}" leaving everything else as is
The above returned the following errors:
/tmp/795703814/libraries/Adafruit_SSD1306_full/Adafruit_SSD1306safe.cpp.o (symbol from plugin): In function `Adafruit_SSD1306::drawFastHLine(int, int, int, unsigned int)':
(.text+0x0): multiple definition of `Adafruit_SSD1306::drawFastHLine(int, int, int, unsigned int)'
/tmp/795703814/libraries/Adafruit_SSD1306_full/Adafruit_SSD1306.cpp.o (symbol from plugin):(.text+0x0): first defined here
/tmp/795703814/libraries/Adafruit_SSD1306_full/Adafruit_SSD1306safe.cpp.o (symbol from plugin): In function `Adafruit_SSD1306::drawFastHLine(int, int, int, unsigned int)':
It returned considerably more that's just the start of a lot but this forum wouldn't let me post this reply if I included them all due to a 9000 charcter limit?
You can't Post more than 9000 characters In a message, but you can Reply, scroll down a little, and use the Attachments and Other options to attach your .ino file.
Go on. A 128x64 is 1024 bytes. A 128x32 is 512 bytes.
The Logo lasts for no time at all. As soon as you draw some real graphics it is overwritten.
You just need to initialise the buffer with your bitmap. If you only declare 900 bytes of a 1024 byte buffer, the un-defined 124 bytes are 0x00. You might just as well use as big a logo as will fit.
There is little point in pasting reams of errors. It is pretty obvious what is the correct syntax (and size)
Thanks for the comments and don't mean to seem ungreatful.... but surely there is only one right way to do this so as David says is there much point in posting lots of errors in whatever format? Would it not just be easier to say exactly where to place the new logo hex code?
Apart from the not posting errors bit I am afraid I didn't much understand anything else you typed David..... I have been using my Arduino for 2 days now so I am afraid there is nothing that is pretty obvious that's why I have asked how to do it
Never mind I worked it out myself and wrote a detailed Instructable on it with all the steps so to help someone else in my situation as for some odd reason a lot of tutorials only include half of the information which makes learning something new like this very frustrating.