adafruit / Adafruit-SSD1351-library

Adafruit library for the 1.27" and 1.5" color OLEDs in the shop
http://www.adafruit.com/products/1431
Other
107 stars 49 forks source link

Display function is not working #40

Open Rishabh028 opened 3 months ago

Rishabh028 commented 3 months ago

I am trying to display the output of serial monitor in a 1.5 oled display but when i am using display.display( ); it is showing error C:\Users\Rishabh\AppData\Local\Temp.arduinoIDE-unsaved202425-13096-sx2s2m.799bi\sketch_mar5a\sketch_mar5a.ino: In function 'void loop()': C:\Users\Rishabh\AppData\Local\Temp.arduinoIDE-unsaved202425-13096-sx2s2m.799bi\sketch_mar5a\sketch_mar5a.ino:36:13: error: 'class Adafruit_SSD1351' has no member named 'display' display.display(); // Update the display ^~~

exit status 1

Compilation error: 'class Adafruit_SSD1351' has no member named 'display'

Janmorgen commented 3 months ago

Hey so I had a similar problem and there isn't really a straight forward fix if you want to update the display at once with pixel data AFAIK. But I got around the issue with a combination of tft.startWrite(); , tft.dmaWait();, and tft.endWrite();

caternuson commented 3 months ago

It's unclear what the actual issue is here. The error message is generally explaining what is happening:

class Adafruit_SSD1351' has no member named 'display'

Why is the call to display() being attempted? It doesn't exist.

Rishabh028 commented 3 months ago

So what should i use to display the serial monitor output of arduino ide in 1.5inch oled spi display ?

zelo66 commented 1 month ago

Hey so I had a similar problem and there isn't really a straight forward fix if you want to update the display at once with pixel data AFAIK. But I got around the issue with a combination of tft.startWrite(); , tft.dmaWait();, and tft.endWrite();

Can you show an example? I don't quite understand how this can replace this function.

caternuson commented 1 month ago

Can someone provide an example sketch code that demonstrates this issue?

Rishabh028 commented 1 week ago

include

include

include

define SCREEN_WIDTH 128

define SCREEN_HEIGHT 128

define OLED_DC 9

define OLED_CS 10

define OLED_RESET 8

Adafruit_SSD1351 display = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, OLED_DC, OLED_RESET, OLED_CS);

void setup() { Serial.begin(9600); // initialize serial communication at 9600 baud

display.begin(0x3D); // Initialize the OLED display display.fillScreen(0x0000); // Fill the screen with black delay(1000); }

void loop() { Serial.println("Hello, world!"); // print "Hello, world!" to the serial monitor delay(1000); // wait for 1 second

// Read from Serial Monitor if (Serial.available() > 0) { String serialData = Serial.readString();

// Display on the OLED
display.fillScreen(0x0000);  // Clear the display
display.setCursor(0, 0);
display.setTextSize(1);
display.setTextColor(0xFFFF);  // White color
display.println(serialData);
display.display();  // Update the display

}

Serial.flush(); // Clear the serial buffer delay(100); // Adjust delay as needed }