Codey OnlineArduino- & ESP32-Komponentenbibliothek › 2.4 inch OLED Display I2C 3.3V
2.4 inch OLED Display I2C 3.3V
Sensoren

2.4 inch OLED Display I2C 3.3V

Dies ist ein 2,4-Zoll-OLED-Displaymodul für den Einsatz mit Mikrocontrollern über die I2C-Schnittstelle (SDA/SCL). Es ist für den Betrieb mit einer 3,3V-Versorgung (VDD) ausgelegt und verwendet GND als Masse; doppelte SDA/SCL- sowie Spannungs-/Masse-Pins sind meist für eine einfachere Verdrahtung vorhanden. Das Display wird häufig verwendet, um Text und einfache Grafiken in Arduino-/ESP32-Lernprojekten darzustellen.

Breite: 76.2 mm

Pinbelegung — 2.4 inch OLED Display I2C 3.3V

Pin Signal Beschreibung
SDA SDA I2C serial data line for the OLED display; connect to MCU SDA.
SCL SCL I2C serial clock line for the OLED display; connect to MCU SCL.
GND ground Ground reference for the OLED module and I2C interface.
VDD power 3.3V power input for the OLED display module.
GND.1 ground Ground reference for the OLED module and I2C interface.
VDD.1 power 3.3V power input for the OLED display module.
SCL.1 SCL I2C serial clock line for the OLED display; connect to MCU SCL.
SDA.1 SDA I2C serial data line for the OLED display; connect to MCU SDA.

Beispielschaltplan — 2.4 inch OLED Display I2C 3.3V

Von Nach Kabel
board:5V x1:VDD red
board:GND x1:GND black
board:SDA x1:SDA green
board:SCL x1:SCL blue

Arduino-Beispielcode — 2.4 inch OLED Display I2C 3.3V

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

#include <Wire.h>
#include <U8g2lib.h>

// 2.4 inch OLED Display I2C 3.3V
// Arduino Uno uses SDA on A4 and SCL on A5.
// This example uses the common U8g2 library with a widely supported SH1106/128x64-style setup.

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);

void setup() {
  Wire.begin();
  u8g2.begin();

  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_6x12_tr);
  u8g2.drawStr(0, 14, "Hello, OLED!");
  u8g2.drawStr(0, 30, "Arduino Uno I2C demo");
  u8g2.drawStr(0, 46, "2.4 inch OLED 3.3V");
  u8g2.sendBuffer();

  Serial.begin(9600);
  Serial.println("OLED initialized and text drawn.");
}

void loop() {
  static unsigned long counter = 0;
  static unsigned long lastUpdate = 0;

  if (millis() - lastUpdate >= 1000) {
    lastUpdate = millis();
    counter++;

    char line[24];
    snprintf(line, sizeof(line), "Seconds: %lu", counter);

    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_6x12_tr);
    u8g2.drawStr(0, 14, "Hello, OLED!");
    u8g2.drawStr(0, 30, "Arduino Uno I2C demo");
    u8g2.drawStr(0, 46, line);
    u8g2.sendBuffer();

    Serial.println(line);
  }
}

Ähnliche Komponenten

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Accelerometer and Gyroscope I2C MPU-6050

Accelerometer and Gyroscope I2C MPU-6050

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten