Frank Girald
/
DisplayOled
Display Oled Driver SSD1306 I2C 128x64
Revision 0:3b87797f65fc, committed 2017-05-16
- Comitter:
- franni
- Date:
- Tue May 16 15:18:54 2017 +0000
- Commit message:
- Display Oled Driver SSD1306 I2C 128x64
Changed in this revision
diff -r 000000000000 -r 3b87797f65fc Adafruit_GFX.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adafruit_GFX.lib Tue May 16 15:18:54 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/franni/code/Adafruit_GFX/#fb6b5dc13938
diff -r 000000000000 -r 3b87797f65fc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 16 15:18:54 2017 +0000 @@ -0,0 +1,103 @@ +#include "mbed.h" +#include "Adafruit_SSD1306.h" + +DigitalOut led1(LED_RED); + +// SPI sub-class that provides a constructed default +class I2CPreInit : public I2C +{ +public: + I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) + { + //frequency(400000); + frequency(100000); + start(); + }; +}; + +I2CPreInit myI2C(PTE0,PTE1); +Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128); + +int main() +{ + uint16_t x=0; + + myOled.begin(); + myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height()); + myOled.display(); + + while(1) + { + led1 = !led1; + myOled.printf("%u\r",x); + myOled.display(); + x = x + 1; + wait(1.0); + } +} + + + + + + +/* +#include "mbed.h" +#include "Adafruit_SSD1306.h" + +class I2CPreInit : public I2C +{ +public: + I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) + { + frequency(100000); + start(); + }; +}; + +I2CPreInit myI2C(PTE0,PTE1); +Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128); + +int main() +{ + + uint16_t x=0; + + myOled.begin(); + myOled.clearDisplay(); + myOled.display(); + wait(0.1); + + myOled.fillCircle(64, 42, 10, 1); + myOled.display(); + wait(1); + myOled.fillCircle(64, 42, 5, 0); + myOled.display(); + wait(1); + + myOled.clearDisplay(); + myOled.display(); + wait(0.1); + + myOled.printf("\r\n OLED %ux%u \r\n\r\n Hello World\r\n\n", myOled.width(), myOled.height()); + + myOled.drawRect(0, 0, 128, 64,1); + myOled.display(); + wait(0.5); + while(1) + { + + myOled.printf("%u\r ",x); + + myOled.drawRect(0, 0, 128, 64,1); + + myOled.display(); + x = x + 1; + wait(0.01); + } +} +*/ + + + +
diff -r 000000000000 -r 3b87797f65fc mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 16 15:18:54 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/4eea097334d6 \ No newline at end of file