Câbler et initialiser un OLED SSD1306
Configurez l’écran OLED Adafruit via I2C.
Câbler et initialiser un OLED SSD1306 est une leçon Arduino & IoT Academy gratuite sur CoddyKit. Ceci est la leçon 1 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Arduino & IoT Academy, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Arduino & IoT Academy comprend 4 leçons au total.
Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.
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.
Questions Fréquemment Posées
La leçon « Câbler et initialiser un OLED SSD1306 » est-elle gratuite ?
Oui — le texte complet de « Câbler et initialiser un OLED SSD1306 » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Arduino & IoT Academy, passe à CoddyKit PRO. Le cours Arduino & IoT Academy comprend 4 leçons au total.
Qu'est-ce que j'apprendrai dans « Câbler et initialiser un OLED SSD1306 » ?
Configurez l’écran OLED Adafruit via I2C. Tu pratiques Arduino & IoT Academy avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.
Dois-je avoir de l'expérience pour commencer Arduino & IoT Academy ?
Aucune expérience préalable n'est requise. Arduino & IoT Academy sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 1 sur 4.
Combien de temps prend la leçon « Câbler et initialiser un OLED SSD1306 » ?
La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.
Peux-tu écrire et exécuter du code dans cette leçon Arduino & IoT Academy ?
Oui. Chaque leçon Arduino & IoT Academy inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.
Toutes les leçons de ce cours
- Câbler et initialiser un OLED SSD1306
- Afficher du texte en plusieurs tailles
- Lignes, rectangles et cercles
- Animer un graphique à barres