#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
#define I2C_ADDRESS 0x3C // 0x3C alt add = 0x3D
SSD1306AsciiWire oled; // create an "oled" object
//------------------------------------------------------------------------------
// Setup displays variable names and units.
// We still have to identify the location and length for variable values.
// We should in the future create functions to do the length and position calc.
void setup() {
Wire.begin(); // initialize the Wire object
Wire.setClock(100000);
oled.begin(&SH1106_128x64, I2C_ADDRESS); // initialize the oled object
oled.setFont(ZevvPeep8x16); // results in 4 lines X 16 characters
oled.clear();
// Fill display so we can see what is being cleared.
oled.println("----------------");
oled.println("----------------");
oled.println("----------------");
oled.println("----------------");
delay(1000);
// (C,R)
oled.SSD1306Ascii::setCursor(0,0);
oled.print("Temp"); // leaves cursor at next char in row.
oled.SSD1306Ascii::setCursor(8*14,0);
oled.print("$F");
oled.clearField(8*4,0,10);
oled.SSD1306Ascii::setCursor(0,2); // note rows are 8 pixels and our font is 16 pixels
oled.print("Humidity"); // leaves cursor at next char in row.
oled.SSD1306Ascii::setCursor(8*15,2);
oled.print("%");
oled.clearField(8*8,2,7);
oled.SSD1306Ascii::setCursor(0,4);
oled.print("Pressure"); // leaves cursor at next char in row.
oled.SSD1306Ascii::setCursor(8*13,4);
oled.print("hPa");
oled.clearField(8*8,4,5);
oled.SSD1306Ascii::setCursor(0,6);
oled.print("IAQ both"); // leaves cursor at next char in row.
oled.clearField(8*3,6,13);
}
void loop() {}