cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I am new to stm32 cubex, i need to display integer values on SSD1306 OLED Display using STM32F103 controller but i am not able to print integer values on my OLED display.

Lchal.1
Associate II

Can you suggest me what i need to add in my code to print integer value.

Thank you

10 REPLIES 10

Use sprintf() to create a string, write the string to the frame buffer bitmap using a font table.​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

int i=25;

char buffer[10];

SSD1306_GotoXY(0,0);

sprintf(buffer, "%s\n", i);

SSD1306_Puts("buffer", &Font_11x18, 1);

HAL_Delay(1000);

should i need to modify my code as written above. If anything i need to add means can you suggest me.

Thank you

or else do i need to add any libraries to print integer values on SSD1306 OLED display

buffer not in quotes​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

thank you

even if i remove the quotes from buffer still i am not able to print integer values on OLED display. what is the problem with my code.

nico 2010
Associate II

Hi,

I think you should do an update screen, after "SSD1306_Puts...".

I mean something like this:

ssd1306_WriteString("Hello!", Font_11x18, White);
ssd1306_UpdateScreen();

 I use the library of Olivier Van den Eede, modified by Le Tan **** 

can i overwrite my integer values in ssd1306 oled .

what i should add in my code so every time my values should overwrite and display on oled .

thank you

Could you perhaps review documentation, or find other examples?

ssd1306_Fill(Black);

ssd1306_SetCursor(1, 1);

ssd1306_WriteString("test", Font_11x18, White);

ssd1306_SetCursor(1, 20);

ssd1306_WriteString("test2", Font_11x18, White);

ssd1306_UpdateScreen();

You could fill the buffer to clear the screen. Should overwrite if you print over same cursor location..

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..