OLED 12864 ssd1306 display variables

Hello,:slight_smile:

I want to send data to Arduino through Bluetooth, then the data displayed on OLED, but I don't know

how to write the code. My code can let my message displayed on serial monitor, but the OLED has no

respond.

Here's my code ;

String comdata = "";    
#include <Adafruit_ssd1306syp.h>
#define SDA_PIN 8
#define SCL_PIN 9

Adafruit_ssd1306syp display(SDA_PIN,SCL_PIN);

void setup()
{
    Serial.begin(9600);
    delay(1000);
    display.initialize();
}

void loop()
{
    while (Serial.available() > 0)  
    {
        comdata += char(Serial.read());
        delay(2);
    }
    if (comdata.length() > 0)
    {
        Serial.println(comdata);
        comdata = "";
    } 
    display.drawLine(0, 0, 127, 63,WHITE);
    display.update();
    delay(100);
    display.clear();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0,0);
    display.println(comdata);
    delay(2000);
}

Thanks!

Which OLED display do you have ? If you bought one on Ebay, can you make a photo of both sides ?
Which Arduino board are you using ? Why do you use pin 8 and 9 for the I2C bus ?

After display.println(), you will need to do display.update().