4 years, 8 months ago.

SSD1306 OLED 128x32 string print problem

I am trying to optimize the use of my oled adafruit, for that I made a simple function that more easily performs the printing of text from the device to the oled, but I have problems putting the text string, since meaningless symbols appear instead of the text I want to print, if I make a display.printf ("Test"); It works perfect, but when using the string the format fails. The function is below :

  1. include <string>

void printText (string text , int x, int y, int size, bool d)

display.TextSize(size); display.TextColor(WHITE); display.TextCursor(x,y); display.printf("%s\t",text); if(d){

display.display(); }

for example in the code, when call the function to print a message :

printText("Message: ", 4, 3 ,1 , false); This doesn´t work

Question relating to:

Be the first to answer this question.