DonghunKang

Dependencies:   mbed Adafruit_GFX

main.cpp

Committer:
eins
Date:
2018-10-29
Revision:
0:46005cfeedb5
Child:
1:ae0b11ca17d1

File content as of revision 0:46005cfeedb5:

#include "mbed.h"
#include "Adafruit_SSD1306.h"   // Adafruit_GFX library

DigitalOut myled(LED1);

int main()
{   
    I2C     I2C_Oled(PB_9, PB_8);       // SDA, SCL
    I2C_Oled.frequency(400000);     // 400kHz clock
    
    Adafruit_SSD1306_I2c    myOled(I2C_Oled, PC_4);    //  D2

    myOled.splash();      // logo output
    myOled.display();
    wait(0.5);
    
    myOled.clearDisplay();  // clear buffer     
    myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height());
    myOled.display();       // show a image on the OLED
    wait(1);
 
    uint16_t n = 0;
    
    while(1)
    {
        myled = !myled;

        myOled.clearDisplay();      
        myOled.setTextCursor(1, 5);
        myOled.printf("<<< UNIST DHE: %u >>>",n++);
        myOled.display();
        wait(0.1);
    }
}