SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By mmelendez73
#188896
I am newbie to Arduino and am just learning the code and now using the Sparkfun Micro OLED. I've successfully tested the OLED with the demo codes (clock, cube, etc.), but have encountered an issue displaying string text with the text font type 2 and 3. For instance, when uploading the following code to the Arduino Pro Mini 3.3V (SPI pin configuration) I get the corresponding results.

Desired result:
oled.print("X");

Summary of Results:
oled.setFontType(0); -> Successfully displays smallest X
oled.setFontType(1); -> Successfully displays smaller X
oled.setFontType(2); -> Nothing displays
oled.setFontType(3); -> Nothing displays

I am able to display floating point integers with font type 2 and 3, but strings seem to be an issue.

Any assistance is greatly appreciated.
Code: Select all
#include <Wire.h>  // Include Wire if you're using I2C
#include <SPI.h>  // Include SPI if you're using SPI
#include <SFE_MicroOLED.h>  // Include the SFE_MicroOLED library

//////////////////////////
// MicroOLED Definition //
//////////////////////////
#define PIN_RESET 9  // Connect RST to pin 9
#define PIN_DC    8  // Connect DC to pin 8
#define PIN_CS    10 // Connect CS to pin 10

//////////////////////////////////
// MicroOLED Object Declaration //
//////////////////////////////////
MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS); // SPI declaration
//MicroOLED oled(PIN_RESET, DC_JUMPER);    // I2C declaration

void setup()
{
oled.begin();
oled.clear(PAGE);
oled.setFontType(3);  // Set the text to large (5 columns, 1 row worth of characters)
oled.setCursor(0, 0); 
oled.print("X"); 
oled.display(); // Draw to the screen

}

void loop()
{
 
}
By fll-freak
#189311
font 0 is the 5*7 font. It contains symbols for all ASCII characters
font 1 is the 8*16 font. It only defines the standard printable characters (space and above)
font 2 is the large numbers. It only defines the basic numbers.
font 3 is the 7 segment font. It only defines The basic numbers and a decimal point.

Trying to print letters with font 2 or 3 will not work as is. If you want to take the time, you could create a new font by drawing letters on graph paper and turning them into numbers.
By mmelendez73
#189450
fll-freak wrote:font 0 is the 5*7 font. It contains symbols for all ASCII characters
font 1 is the 8*16 font. It only defines the standard printable characters (space and above)
font 2 is the large numbers. It only defines the basic numbers.
font 3 is the 7 segment font. It only defines The basic numbers and a decimal point.

Trying to print letters with font 2 or 3 will not work as is. If you want to take the time, you could create a new font by drawing letters on graph paper and turning them into numbers.
Thank you very much Skye for clearing that up. I can work with that. - Mike