Write the OLED(using I2C)

Dependencies:   Adafruit_GFX mbed

Revision:
12:f7375e185594
Parent:
11:f4ecb5faeffe
Child:
13:52e9c29e2f88
--- a/main.cpp	Wed Feb 03 07:37:35 2016 +0000
+++ b/main.cpp	Mon Apr 17 01:42:24 2017 +0000
@@ -3,26 +3,20 @@
 
 DigitalOut myled_R(LED_RED);
 
-// SPI sub-class that provides a constructed default
-class I2CPreInit : public I2C
-{
-public:
-    I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl)
-    {
-        frequency(100000);
-        start();
-    };
-};
+I2C i2c(PA_10,PA_9);
 
-I2CPreInit myI2C(PA_10,PA_9);
-Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128);
+Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128);
+
 
 int main()
 {   
+    //i2c.frequency(100000);
+    i2c.start();
+
     uint16_t x=0;
  
     myOled.begin();
-    myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height());
+    myOled.printf("%ux%u \nHellow World\r\n", myOled.width(), myOled.height());
     myOled.display();
 
     while(1)
@@ -34,3 +28,4 @@
         wait(1.0);
     }
 }
+