This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
speedclock/Arduino_Libs/SSD1306Ascii-master/examples/FontSamplesWire/FontSamplesWire.ino
2018-07-07 19:17:51 +02:00

93 lines
No EOL
1.8 KiB
C++

// Display samples of fonts.
//
#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C
// Define proper RST_PIN if required.
#define RST_PIN -1
const char* fontName[] = {
"Arial14",
"Arial_bold_14",
"Callibri11",
"Callibri11_bold",
"Callibri11_italic",
"Callibri15",
"Corsiva_12",
"fixed_bold10x15",
"font5x7",
"font8x8",
"Iain5x7",
"lcd5x7",
"Stang5x7",
"System5x7",
"TimesNewRoman16",
"TimesNewRoman16_bold",
"TimesNewRoman16_italic",
"utf8font10x16",
"Verdana12",
"Verdana12_bold",
"Verdana12_italic",
"X11fixed7x14",
"X11fixed7x14B",
"ZevvPeep8x16"
};
const uint8_t* fontList[] = {
Arial14,
Arial_bold_14,
Callibri11,
Callibri11_bold,
Callibri11_italic,
Callibri15,
Corsiva_12,
fixed_bold10x15,
font5x7,
font8x8,
Iain5x7,
lcd5x7,
Stang5x7,
System5x7,
TimesNewRoman16,
TimesNewRoman16_bold,
TimesNewRoman16_italic,
utf8font10x16,
Verdana12,
Verdana12_bold,
Verdana12_italic,
X11fixed7x14,
X11fixed7x14B,
ZevvPeep8x16
};
uint8_t nFont = sizeof(fontList)/sizeof(uint8_t*);
SSD1306AsciiWire oled;
//------------------------------------------------------------------------------
void setup() {
Wire.begin();
Wire.setClock(400000L);
#if RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN);
#else // RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS);
#endif // RST_PIN >= 0
for (uint8_t i = 0; i < nFont; i++) {
oled.setFont(System5x7);
oled.clear();
oled.println(fontName[i]);
oled.println();
oled.setFont(fontList[i]);
oled.println("*+,-./0123456789:");
oled.println("abcdefghijklmno");
oled.println("ABCDEFGHIJKLMNO");
delay(10000);
}
oled.clear();
oled.print("Done!");
}
void loop() {}