Skip to content

Instantly share code, notes, and snippets.

@spoterianski
Created November 15, 2017 20:50
Show Gist options
  • Save spoterianski/67601f24d46a09a4456c24a7da2c0f71 to your computer and use it in GitHub Desktop.
Save spoterianski/67601f24d46a09a4456c24a7da2c0f71 to your computer and use it in GitHub Desktop.
H&R Logo on ESP32 Wifi Kit (simple demo)
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16);
int c = 0;
void setup(void) {
u8g2.begin();
}
void drawLogo(void)
{
u8g2.setFontMode(1); // Transparent
u8g2.setFontDirection(0);
if(c == 0){
// Hello
u8g2.setFont(u8g2_font_inb24_mf);
u8g2.drawStr(6, 30, "Hello!");
c++;
}
else if(c == 1){
// Welcome
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(8, 30, "welcome to");
c++;
}
else{
// LOGO
u8g2.setFont(u8g2_font_inb24_mf);
u8g2.drawStr(30, 30, "H&R");
u8g2.drawHLine(22, 38, 80);
u8g2.drawHLine(22, 39, 80);
c = 0;
}
}
void drawURL(void)
{
//u8g2.setFont(u8g2_font_4x6_tr);
u8g2.setFont(u8g2_font_t0_11_tf);
u8g2.drawStr(8,56,"http://eax.me/hnr/");
}
void loop(void) {
u8g2.clearBuffer();
drawLogo();
drawURL();
u8g2.sendBuffer();
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment