lexus2k / ssd1306

Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
MIT License
664 stars 127 forks source link

Numbers #100

Closed moo06 closed 4 years ago

moo06 commented 4 years ago

Hi, Is there any way I could print a variable onto the OLED?

Thanks

lexus2k commented 4 years ago

Hi,

what type of variable you're trying to print?

moo06 commented 4 years ago

Hi, It is an analogRead() because I'm debugging the button values so I can make a tech demo. Since I'm using an ATTINY85, and I'm using practically all the pins, I can only try and show it on the screen.

Thanks

lexus2k commented 4 years ago

Hi here is an example for printing numbers:

#include "ssd1306.h"
#include <stdio.h>

void printNumber(int x, int y, int number)
{
    char intStr[12];
    snprintf(intStr, sizeof(intStr), "%i", number );
    ssd1306_printFixed (x, y, intStr, STYLE_NORMAL);
}

Dup of #96

lexus2k commented 4 years ago

Did the example above help you?

moo06 commented 4 years ago

Hi, yes thank you.