haut ⇨ ⇦bas
Electro
ipv4:216.73.216.164
Année scolaire 2025-2026
stylo
Mini écran OLED

Aujourd'hui j'ai mis en route une carte nano avec un mini écran OLED : ECRAN OLED I2C 128X64.

Matériel nécessaire : un arduino nano, un écran, 4 fils.

On utilise le port I²C (les ports A4(SDA) et A5(SDL) du nano)

le module


montage
Le programme:
#include < SPI.h >
#include < Wire.h >
#include < Adafruit_GFX.h >
#include < Adafruit_SSD1306.h >
// OLED display width and height, in pixels
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

// Declaration for an SSD1306 display
// connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // (-1 Arduino reset pin)
Adafruit_SSD1306 display(
SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);
  // Address 0x3D for 128x64
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 
  display.clearDisplay();
  delay(2000); // Pause for 2 seconds
  testdrawstyles();
}

void loop() {
}


void testdrawstyles(void) {
  display.clearDisplay();

  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(WHITE); // Draw white text
  display.setCursor(0,0);      // Start at top-left corner
  display.println("Hello, world!");
  display.println("");
  display.setTextSize(4);      // Draw 4X-scale text
  display.setTextColor(WHITE);
  display.println("YES!");
  display.display();
  delay(2000);
}
écrit par : Stéphane Le Méteil, le 23/02/2023
Derniers articles publiés :
Le 13/02/2026 dans bia sous le titre : 13 Février
Le 09/02/2026 dans bia sous le titre : 6 Février
Le 03/02/2026 dans Cira1 sous le titre : Primitives
Le 03/02/2026 dans Première sous le titre : Contrôle N°5
Le 01/02/2026 dans Latex sous le titre : Bonne entête
Version du 30 Janvier 2026