0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

秋月の0.96インチ白色OLEDで遊ぶ(Arduino UNO)P-12031

Last updated at Posted at 2023-02-05

x 過去ログをみよ (SSD1306互換機のログ)

o_cop524.jpg

目的
SSD1306その互換機の標準的なライブラリになっている
Adafruit SSD1306 + Adafruit GFXのインストール で
文字列を表示して遊ぶ
I2Cアドレスと縦の画面幅でハマるて沼る人が多数の為
Adafruit純正だと
128x32 3C
128x64 3D

秋月のは、128x64の3C

SCL-SCL
SDA-SDA
3.3V-3.3V
GND-GND

レシピ

0.96インチ 128×64ドット有機ELディスプレイ(OLED) 白色
通販コード P-12031
発売日 2017/11/27

[秋月のホームページより引用]

o_cop373.jpg

[配線は、各自確認の事]

o_cop374.jpg

実用的な時計や温度計のまとめ(参考)

o_cop385.jpg

プログラムのサンプル

o_cop371.jpg

手順

1.Adafruit SSD1306のインストール
2.Adafruit GFXのインストール
3.アドレスの確認
4.とりあえず表示してみる
5.ビットマップの表示




//i2c_ssd1306_UNO_uno_1


//ヘッダーファイル
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>


//定義
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


//初期化
void setup() {

  // I2Cアドレスは使用するディスプレイに合わせて変更する
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);

}//setup


//メインループ
void loop() {

  // 画面表示をクリア
  display.clearDisplay();

  // テキストサイズを設定
  display.setTextSize(3);
  // テキスト色を設定
  display.setTextColor(WHITE);
  // テキストの開始位置を設定
  display.setCursor(0, 10);


  // 1行目に46を表示
  display.println("UNO");

  // 描画バッファの内容を画面に表示
  display.display();

  delay(1000); //1秒待つ

}//loop



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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?