TeensyView numbers in full height on the displays

Status
Not open for further replies.

wendy

New member
Playing with the TeensyView (Sparkfun) with the ssd1306 controller.

I was planning to display 6 digits on the display with a height of 32 pixels, but the demos only show 16 pixels as a maximum. I actually need 0..9 and decimal point.
How can I display these at full display height ?
 
You will have to create/code a new font file with a 32 pixel high font if none of the 4 included fonts does meet your requirements. There are enough informations and details within the library‘s and the font files‘ source code.
 
Thanks, I have looked at the font files in the library... but I just started with Teensy/Arduino and not able to figure it out for now.
Are there any resources online to get me started on the font subject ?
 
I don’t think that there are online resources for that specific issue, besides of the SSD1306 data sheet which describes (among others) the memory map of the display buffer. And transforming a bitmap into an appropriate series of bytes is a simple and obvious task, even for a beginner, especially since you have 4 example font files to study as examples.
 
You can search the web for font files. E.g. this one:

FreeSans18pt7b

almost fits. Try this and you will see that the size of the font is 33 pixels. Probably you will have to make your own font. Search for "adafruit ssd1306 font creation" on the web.



#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSans18pt7b.h>

#define OLED_RESET 4

Adafruit_SSD1306 display(OLED_RESET);

void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
display.setFont(&FreeSans18pt7b);
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 23);
display.print("H");
display.setCursor(25, 24);
display.print("H");
display.setCursor(50, 23);
display.print("g");
display.setCursor(75, 24);
display.print("g");
display.drawLine(73, 0, 73, 31, WHITE);
display.display();
}

void loop()
{
}
 
Status
Not open for further replies.
Back
Top