![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Guide program for display oled I2C 128x64
Dependencies: mbed Adafruit_GFX
main.cpp@14:2fc2f14f5f86, 2019-09-25 (annotated)
- Committer:
- deepanaishtaweera174
- Date:
- Wed Sep 25 15:57:32 2019 +0000
- Revision:
- 14:2fc2f14f5f86
- Parent:
- 13:52e9c29e2f88
working code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaizen | 0:81a58b2fb28e | 1 | #include "mbed.h" |
kaizen | 0:81a58b2fb28e | 2 | #include "Adafruit_SSD1306.h" |
IOP | 8:e61e86355653 | 3 | |
deepanaishtaweera174 | 14:2fc2f14f5f86 | 4 | DigitalOut myled_R(LED1); |
kaizen | 0:81a58b2fb28e | 5 | |
deepanaishtaweera174 | 14:2fc2f14f5f86 | 6 | I2C i2c(I2C_SDA,I2C_SCL); |
kaizen | 0:81a58b2fb28e | 7 | |
WIzMatthew | 12:f7375e185594 | 8 | Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128); |
WIzMatthew | 12:f7375e185594 | 9 | |
kaizen | 0:81a58b2fb28e | 10 | |
kaizen | 0:81a58b2fb28e | 11 | int main() |
IOP | 9:a6021ca48d2e | 12 | { |
IOP | 9:a6021ca48d2e | 13 | uint16_t x=0; |
jcm931213 | 13:52e9c29e2f88 | 14 | |
IOP | 9:a6021ca48d2e | 15 | myOled.begin(); |
WIzMatthew | 12:f7375e185594 | 16 | myOled.printf("%ux%u \nHellow World\r\n", myOled.width(), myOled.height()); |
IOP | 9:a6021ca48d2e | 17 | myOled.display(); |
kaizen | 0:81a58b2fb28e | 18 | |
kaizen | 0:81a58b2fb28e | 19 | while(1) |
kaizen | 0:81a58b2fb28e | 20 | { |
IOP | 8:e61e86355653 | 21 | myled_R = !myled_R; |
IOP | 9:a6021ca48d2e | 22 | myOled.printf("%u\r",x); |
IOP | 9:a6021ca48d2e | 23 | myOled.display(); |
IOP | 9:a6021ca48d2e | 24 | x = x + 1; |
deepanaishtaweera174 | 14:2fc2f14f5f86 | 25 | wait(0.1); |
kaizen | 0:81a58b2fb28e | 26 | } |
kaizen | 0:81a58b2fb28e | 27 | } |