Skip to content

Instantly share code, notes, and snippets.

@idreamsi
Last active September 3, 2019 16:30
Show Gist options
  • Save idreamsi/8b01321006c8391b784940ad77578e9d to your computer and use it in GitHub Desktop.
Save idreamsi/8b01321006c8391b784940ad77578e9d to your computer and use it in GitHub Desktop.
UTF-8 test with u8g2
#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_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6);
void setup(void)
{
Serial.begin(9600);
u8g2.begin();
}
void loop(void){
u8g2.enableUTF8Print();
u8g2.setFont(vazirm14); //set font
uint16_t v = 0x0628;
char lo = v & 0xFF;
char hi = v >> 8;
String output = String(hi) + String(lo);
u8g2.firstPage();
do {
u8g2.setCursor(10, 50);
u8g2.print(output);
} while ( u8g2.nextPage() );
delay(10000);
}
@idreamsi
Copy link
Author

idreamsi commented Sep 3, 2019

99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment