SSD1306 OLEDを配線・初期化する
I2C経由でAdafruit OLEDをセットアップします。
「SSD1306 OLEDを配線・初期化する」はCoddyKit上の無料Arduino & IoT Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはArduino & IoT Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Arduino & IoT Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Meet the OLED
An OLED is a tiny self-lit screen. Each pixel glows on its own, so you get crisp text and sharp graphics with no backlight needed. 💡
The SSD1306 Chip
Most small OLEDs are driven by the SSD1306 controller. It manages the pixels for you, so your code just says what to draw, not how to light each dot.
Just Four Wires
An I2C OLED needs only four pins: VCC, GND, SDA, and SCL. Two for power, two for data. That simple wiring is why these screens are so popular.
Where SDA and SCL Go
On an Arduino Uno, SDA connects to A4 and SCL to A5. These are the board's built-in I2C lines, shared by every I2C device you add.
The I2C Address
Each I2C device answers to an address. Most SSD1306 OLEDs use 0x3C. You pass this number so the board knows which chip it is talking to.
The Adafruit Libraries
You drive the screen with two helpers: Adafruit_SSD1306 for the hardware and Adafruit_GFX for drawing. Install both from the Library Manager.
Include and Size
Start your sketch by including the libraries and stating the screen size. A common panel is 128x64 pixels wide by tall.
#include <Adafruit_SSD1306.h>
#define WIDTH 128
#define HEIGHT 64Create the Display Object
Make a display object that represents the screen. You hand it the size so every later draw call knows the canvas bounds.
Adafruit_SSD1306 display(WIDTH, HEIGHT, &Wire, -1);Begin in setup()
Inside setup, call display.begin() with the address 0x3C. This powers up the panel and prepares it to receive your drawings.
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);Clear the Buffer
Drawing happens in memory first. Call clearDisplay() to wipe that buffer so old pixels do not linger behind your new content.
display.clearDisplay();Push It to the Screen
Nothing shows until you call display(). It sends the whole buffer to the OLED at once, so changes appear together with no flicker.
display.display();Quick Check
You set up the screen but it stays blank. What did you forget?
Recap
You wired four pins, included the Adafruit libraries, began the SSD1306 at 0x3C, and learned to clear then push the buffer. Your OLED is ready to draw.
よくある質問
「SSD1306 OLEDを配線・初期化する」レッスンは無料ですか?
はい。「SSD1306 OLEDを配線・初期化する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Arduino & IoT Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Arduino & IoT Academyコースには全4レッスンが含まれています。
「SSD1306 OLEDを配線・初期化する」で何を学びますか?
I2C経由でAdafruit OLEDをセットアップします。 ブラウザで直接実行するハンズオンコードでArduino & IoT Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Arduino & IoT Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのArduino & IoT Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「SSD1306 OLEDを配線・初期化する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このArduino & IoT Academyレッスンでコードを書いて実行できますか?
はい。すべてのArduino & IoT Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- SSD1306 OLEDを配線・初期化する
- 複数のサイズでテキストを描く
- 線、長方形、円
- 棒グラフをアニメーション表示する