oled-i2c.ino

Arduino GIGA R1 · File : oled-i2c.ino · Language : Arduino · Use case : Afficher l'état de la carte sur un OLED I2C

The GIGA's I2C bus (D14/D15 plus the dedicated connector) takes standard 3.3 V modules: the OLED shows uptime and memory, the minimal dashboard for any H7 project.

Hardware required

An Arduino Giga R1 board (STM32H747 dual-core M7 at 480 MHz + M4, 76 I/O pins, 2 DACs, FDCAN) powered over USB-C or 5-24 V. 1 I2C SSD1306 128×64 OLED.

Wiring

SDA on D15, SCL on D14 (or the edge I2C connector), VCC 3.3 V, GND.

How it works

Wire (Mbed's I2C1) + Adafruit_SSD1306: RAM framebuffer copied on display(). begin() returns false when nothing answers at 0x3C — debugging lives in the monitor. In the Arduino IDE, install the « Arduino Zephyr-based Boards » (or Mbed) platform, select « Arduino Giga R1 », then Upload. 3.3 V logic.

Going further

Add real inputs (ADC, buttons) to the screen, or a calibration menu driven over CAN.

oled-i2c.ino

// OLED SSD1306 sur le connecteur Qwiic/I2C (Wire) de la GIGA.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 oled(128, 64, &Wire, -1);

void setup() {
  Serial.begin(115200);
  Wire.begin();
  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED 0x3C absent"); for (;;);
  }
  oled.clearDisplay();
}

void loop() {
  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setTextColor(SSD1306_WHITE);
  oled.setCursor(0, 0);
  oled.printf("GIGA R1\n%lu ms\n", millis());
  oled.printf("libre : %u Ko\n", (unsigned)(ESP.getFreeHeap() / 1024));
  oled.display();
  delay(200);
}

← Back to the board