Skip to main content
Lchal.1
Associate III
Aug 31, 2020 11:34 AM UTC
Question

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.

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

Thank you

This topic has been closed for replies.

10 replies

Tesla DeLorean
Guru
Aug 31, 2020 12:43 PM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Lchal.1
Lchal.1Author
Associate III
Sep 2, 2020 3:43 AM UTC

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

Lchal.1
Lchal.1Author
Associate III
Sep 2, 2020 3:54 AM UTC

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

nico 2010
Associate
Sep 4, 2020 7:25 AM UTC

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 **** 

Lchal.1
Lchal.1Author
Associate III
Sep 4, 2020 11:26 AM UTC

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

Tesla DeLorean
Guru
Sep 4, 2020 11:38 AM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..