Display Oled Driver SSD1306 I2C 128x64
Dependencies: SSD1306_128x64_I2C mbed
Fork of DisplayOled by
Revision 1:7195b6d24cf4, committed 2017-05-23
- Comitter:
- franni
- Date:
- Tue May 23 18:39:12 2017 +0000
- Parent:
- 0:3b87797f65fc
- Commit message:
- DISPLAY OLED SSD1306 I2C
Changed in this revision
diff -r 3b87797f65fc -r 7195b6d24cf4 Adafruit_GFX.lib --- a/Adafruit_GFX.lib Tue May 16 15:18:54 2017 +0000 +++ b/Adafruit_GFX.lib Tue May 23 18:39:12 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/franni/code/Adafruit_GFX/#fb6b5dc13938 +https://developer.mbed.org/users/franni/code/Adafruit_GFX/#086eea28d1dd
diff -r 3b87797f65fc -r 7195b6d24cf4 SSD1306_128x64_I2C.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SSD1306_128x64_I2C.lib Tue May 23 18:39:12 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/jk1lot/code/SSD1306_128x64_I2C/#46dcbaa430f4
diff -r 3b87797f65fc -r 7195b6d24cf4 main.cpp --- a/main.cpp Tue May 16 15:18:54 2017 +0000 +++ b/main.cpp Tue May 23 18:39:12 2017 +0000 @@ -1,103 +1,22 @@ -#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); + #include "mbed.h" + #include "SSD1306.h" -int main() -{ - uint16_t x=0; + #define D_SDA PTE25 + #define D_SCL PTE24 + I2C i2c(D_SDA, D_SCL); + + SSD1306 oled = SSD1306(i2c, SSD1308_SA0); - myOled.begin(); - myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height()); - myOled.display(); + int main() { + oled.writeString(0, 0, "Universidad Distrital"); + // oled.printf("Hello World !"); + wait(1); + + oled.writeString(0, 0, "2017 Digitales II"); - 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); - } -} -*/ - - - -