![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Guide program for display oled I2C 128x64
Dependencies: mbed Adafruit_GFX
Diff: main.cpp
- Revision:
- 12:f7375e185594
- Parent:
- 11:f4ecb5faeffe
- Child:
- 13:52e9c29e2f88
diff -r f4ecb5faeffe -r f7375e185594 main.cpp --- 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); } } +