![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Write the OLED(using I2C) l432KCc PIN sda scl reset
Dependencies: Adafruit_GFX mbed
Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by
main.cpp@12:f7375e185594, 2017-04-17 (annotated)
- Committer:
- WIzMatthew
- Date:
- Mon Apr 17 01:42:24 2017 +0000
- Revision:
- 12:f7375e185594
- Parent:
- 11:f4ecb5faeffe
- Child:
- 13:52e9c29e2f88
Modify I2C class in main.cpp
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 | |
IOP | 10:abbd34fe7ce1 | 4 | DigitalOut myled_R(LED_RED); |
kaizen | 0:81a58b2fb28e | 5 | |
WIzMatthew | 12:f7375e185594 | 6 | I2C i2c(PA_10,PA_9); |
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 | { |
WIzMatthew | 12:f7375e185594 | 13 | //i2c.frequency(100000); |
WIzMatthew | 12:f7375e185594 | 14 | i2c.start(); |
WIzMatthew | 12:f7375e185594 | 15 | |
IOP | 9:a6021ca48d2e | 16 | uint16_t x=0; |
kaizen | 0:81a58b2fb28e | 17 | |
IOP | 9:a6021ca48d2e | 18 | myOled.begin(); |
WIzMatthew | 12:f7375e185594 | 19 | myOled.printf("%ux%u \nHellow World\r\n", myOled.width(), myOled.height()); |
IOP | 9:a6021ca48d2e | 20 | myOled.display(); |
kaizen | 0:81a58b2fb28e | 21 | |
kaizen | 0:81a58b2fb28e | 22 | while(1) |
kaizen | 0:81a58b2fb28e | 23 | { |
IOP | 8:e61e86355653 | 24 | myled_R = !myled_R; |
IOP | 9:a6021ca48d2e | 25 | myOled.printf("%u\r",x); |
IOP | 9:a6021ca48d2e | 26 | myOled.display(); |
IOP | 9:a6021ca48d2e | 27 | x = x + 1; |
IOP | 9:a6021ca48d2e | 28 | wait(1.0); |
kaizen | 0:81a58b2fb28e | 29 | } |
kaizen | 0:81a58b2fb28e | 30 | } |
WIzMatthew | 12:f7375e185594 | 31 |