U8x8 OLED 2.42 display + concatenating space issue

Hello. I am using a 2.42" 128x64 OLED display that uses the SSD1309 chip. I have the display working using the u8x8 library for Arduino. My question though stems from a spacing issue on the display when I have an updating value that is at the beginning of the line. I wanted to display an updating timer so I used itoa() to turn the changing integer into a char. Then I concatenated that to a character array of letters using strcat() . As the value updates and gets bigger (1 digit then 2 digit then 3 digit... etc) everything that comes after it gets shifted. Is there a way to split the display screen or not have this shifting happening. If I understand this correctly, the total number of characters for the 128x64 pixel display is 16x8 characters based on the u8x8 library. Maybe there is a better library or display of similar size to work with?

Thank you

Use sprintf() to concatenate the integer and the character array. No need to use itoa() and you can format the integer to always use the same number of columns and pad out with spaces

Thanks @UKHeliBob. I have not tried that but I manage to stop the shifting. I just needed to assign the second set of characters a starting x,y position instead of letting it trail after the first set of characters that started at position 0,0.

I was going to suggest your solution but did not as it seemed so obvious

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.