Skip to content

Instantly share code, notes, and snippets.

@shikarunochi
Created April 15, 2020 09:09
Show Gist options
  • Save shikarunochi/008dc3c25742c2d890aef2afbac718f2 to your computer and use it in GitHub Desktop.
Save shikarunochi/008dc3c25742c2d890aef2afbac718f2 to your computer and use it in GitHub Desktop.
M5Atom + SSD1306 日本語表示
#include <M5Atom.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "efontEnableJa.h"
#include "efontSSD1306.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(115200);
M5.begin();
Wire.begin(21,25);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.clearDisplay();
printEfont(&display, "こんにちワールド日本語チャレンジ!",0,0,2);
display.display();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment