LoginSignup
0
0

More than 1 year has passed since last update.

DigisparkでOLED SSD1306

Last updated at Posted at 2022-05-04

u8x8を使って,無事動きました。

main.cpp
#include <Arduino.h>
#include <U8x8lib.h>

U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 2, /* data=*/ 0, /* reset=*/ U8X8_PIN_NONE); // Digispark ATTiny85

void setup(void)
{
  u8x8.begin();  
}

void loop(void)
{
  u8x8.setCursor(0, 0);
  // u8x8.setFont(u8x8_font_8x13_1x2_f); // too big size
  // u8x8.setFont(u8x8_font_7x14_1x2_f); // too big size
  // u8x8.setFont(u8x8_font_5x7_f); // good
  u8x8.setFont(u8x8_font_torussansbold8_r); // good
  u8x8.print("Hello World!\r\n");

  delay(2000);
  u8x8.clear();
}

指定するフォントにより,ATTinyの容量に収まりませんでした。

platformio.ini
[env:digispark-tiny]
platform = atmelavr
board = digispark-tiny
framework = arduino
lib_deps = olikraus/U8g2@^2.33.2

自分でドライバーらしきものを書こうと数年前奮闘していたけど,実はあっさり動くなんて... 感謝です!

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0