Skip to content

error when several ssd1306 128x64 #268

Open
@Qu4zar

Description

@Qu4zar
  • Arduino board: ARDUINO UNO

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.1.1

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):
    My problem
    I can't use 2 SSD1306 at the same time.
    I have 2 SSD1306 128x64 but when I define SSD1306_128_64 in the Adafruit_SSD1306.h program, it doesn't work (only on 1 screen).
    I only can define 1 screen if I use the "new way", display(w,h,wire,-1) and I didn't find a solution in the forum.

I can define SSD1306_128_32, it works, but the words size is too big for my application.

My Sketch :
#include <Wire.h>
#include <Adafruit_SSD1306.h>

//Adafruit_SSD1306 ecranOLED0(128, 64, &Wire, -1);
//Adafruit_SSD1306 ecranOLED1(128, 64, &Wire, -1);

Adafruit_SSD1306 display1(0);
Adafruit_SSD1306 display2(1);

void setup() {
// Initialisation des écrans avec leurs adresses I2C
display1.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display2.begin(SSD1306_SWITCHCAPVCC, 0x3D);

// Le reste de votre configuration
}

void loop() {
// Contrôlez les écrans individuellement ici

// Exemple : Afficher du texte sur le premier écran
display1.clearDisplay();
display1.setTextColor(SSD1306_WHITE);
display1.setCursor(0, 0);
display1.println("Oh");
display1.display();

// Exemple : Afficher du texte sur le deuxième écran
display2.clearDisplay();
display2.setTextColor(SSD1306_WHITE);
display2.setCursor(0, 0);
display2.println("mince");
display2.display();

// Le reste de votre code loop
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions