SSD1306
Fork of SSD1306_LCD-HelloWorld by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "Adafruit_SSD1306.h" 00003 00004 DigitalOut myled(LED1); 00005 00006 #if defined(TARGET_WIZwiki_W7500) 00007 #define SDA PA_10 00008 #define SCL PA_9 00009 #endif 00010 00011 // an SPI sub-class that provides a constructed default 00012 class I2CPreInit : public I2C 00013 { 00014 public: 00015 I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) 00016 { 00017 frequency(100000); 00018 start(); 00019 }; 00020 }; 00021 00022 I2CPreInit gI2C(PA_10,PA_9); 00023 Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128); 00024 Serial pc(USBTX,USBRX); 00025 00026 int main() 00027 { uint16_t x=0; 00028 00029 gOled.begin(); 00030 gOled.printf("%ux%u OLED Display\r\n", gOled.width(), gOled.height()); 00031 gOled.display(); 00032 00033 00034 while(1) 00035 { 00036 myled = !myled; 00037 gOled.printf("%u\r",x); 00038 gOled.display(); 00039 x = x + 1; 00040 wait(1); 00041 } 00042 }
Generated on Tue Jul 12 2022 21:04:12 by 1.7.2