Hello everybody,
I'm trying to drive two SPI OLED displays with the Adafruit ssd1306 library on an Uno.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
/*#define OLED_MOSI_R 9
#define OLED_CLK_R 10
#define OLED_DC_R 11
#define OLED_CS_R 12
#define OLED_RESET_R 13
Adafruit_SSD1306 display_R(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI_R, OLED_CLK_R, OLED_DC_R, OLED_RESET_R, OLED_CS_R);
*/
#define OLED_MOSI_L 3
#define OLED_CLK_L 2
#define OLED_DC_L 5
#define OLED_CS_L 7
#define OLED_RESET_L 4
Adafruit_SSD1306 display_L(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI_L, OLED_CLK_L, OLED_DC_L, OLED_RESET_L, OLED_CS_L);
void setup() {
//display_R.begin(SSD1306_SWITCHCAPVCC);
display_L.begin(SSD1306_SWITCHCAPVCC);
}
void loop() {
//display_R.clearDisplay();
display_L.clearDisplay();
/*display_R.setTextSize(3);
display_R.setTextColor(SSD1306_WHITE);
display_R.setCursor(0,0);
display_R.println(F("R"));
display_R.display();
*/
display_L.setTextSize(3);
display_L.setTextColor(SSD1306_WHITE);
display_L.setCursor(0,0);
display_L.println(F("L"));
display_L.display();
}
If I comment one out, the other works and vice versa, so the wiring is ok. I can't get them to work at the same time.
Any help appreciated (I'm very new to Aruino and C++)