![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
1.3''OLED
Dependencies: mbed QEI OLED_SSD1306_SH1106 I2C_SSD1306_nucleo_l432KC
Diff: main.cpp
- Revision:
- 9:a6021ca48d2e
- Parent:
- 8:e61e86355653
- Child:
- 10:abbd34fe7ce1
--- a/main.cpp Fri Jul 24 01:20:00 2015 +0000 +++ b/main.cpp Wed Aug 05 00:07:56 2015 +0000 @@ -1,10 +1,8 @@ #include "mbed.h" #include "Adafruit_SSD1306.h" -DigitalOut shield_led_off(D10); DigitalOut myled_R(LED1); - // an SPI sub-class that provides a constructed default class I2CPreInit : public I2C { @@ -16,26 +14,23 @@ }; }; -I2CPreInit gI2C(PA_10,PA_9); -Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128); -Serial pc(USBTX,USBRX); +I2CPreInit myI2C(PA_10,PA_9); +Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128); int main() -{ uint16_t x=0; - - shield_led_off = 0; // turn off Green LED on shield +{ + uint16_t x=0; - gOled.begin(); - gOled.printf("%ux%u Hellow World\r\n", gOled.width(), gOled.height()); - gOled.display(); - + myOled.begin(); + myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height()); + myOled.display(); while(1) { myled_R = !myled_R; - gOled.printf("%u\r",x); - gOled.display(); - x = x + 1; - wait(1); + myOled.printf("%u\r",x); + myOled.display(); + x = x + 1; + wait(1.0); } }