Using the SSD1306 based 128×64 OLED display

In the program showtime.lua (http://sourceforge.net/projects/nodemcu/files/showtime.lua) I use the OLED display mentioned above to display the time requested from (Google) server  .

In the initialization phase you have to decide which font should be used to display the text information.

-- graphic components
function prepare()
disp:setFont(u8g.font_6x10)
disp:setScale2x2()
disp:setFontRefHeightExtendedText()
disp:setDefaultForegroundColor()
disp:setFontPosTop()
end

The library U8glib (Universal Graphics Library for 8 Bit Embedded Systems) offers a lot of fonts.

Not all of them are available in the standard compilation of NodeMCU. A look to the file nodemcu-firmware/app/include/u8g_config.h shows us that the fonts 6×10 and chikita are available here.

// Configure U8glib fonts
// add a U8G_FONT_TABLE_ENTRY for each font you want to compile into the image

#define U8G_FONT_TABLE_ENTRY(font)
#define U8G_FONT_TABLE \
             U8G_FONT_TABLE_ENTRY(font_6x10) \
U8G_FONT_TABLE_ENTRY(font_chikita)
#undef U8G_FONT_TABLE_ENTRY

If you want to use other fonts you have to include them into this configuration file and recompile the whole project.

Advertisements
Using the SSD1306 based 128×64 OLED display

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s