Go Down

Topic: OLED 12864 ssd1306 display variables (Read 18 times) previous topic - next topic

firecloud

Hello,:)

      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 ;

     
       
Code: [Select]
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!

Peter_n

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 ?
Octal is 7 bits. Octet is 8 bits. An Octopus has four pairs of arms. October is the tenth month. An Octillion can be 10^27 or 10^48. An Octave is the interval between notes of half or twice the frequency. And last but not least: Octyl on its own is not really something.

Go Up