DonghunKang
Dependencies: mbed Adafruit_GFX
main.cpp
- Committer:
- eins
- Date:
- 2019-10-16
- Revision:
- 1:ae0b11ca17d1
- Parent:
- 0:46005cfeedb5
- Child:
- 2:3061fe655b7d
File content as of revision 1:ae0b11ca17d1:
#include "mbed.h" #include "Adafruit_SSD1306.h" // Adafruit_GFX library Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED1); DigitalOut redLed(PA_12); DigitalIn myButton(PC_13); DigitalIn exButton(PC_11); BusOut my7Seg(PA_8, PA_9, PA_10, PC_9, PC_8, PC_7, PC_6, PA_11); // 8bit data // LSB, , MSB char val7Seg[16] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71}; char rxData[5]; bool flagRx = 0; int main() { I2C I2C_Oled(PB_7, PA_15); // SDA, SCL I2C_Oled.frequency(400000); // 400kHz clock Adafruit_SSD1306_I2c myOled(I2C_Oled, PA_1); // D2 myOled.splash(); // logo output myOled.display(); wait(0.5); myOled.clearDisplay(); // clear buffer myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height()); myOled.display(); // show a image on the OLED wait(1); uint16_t n = 0; while(1) { myled = !myled; myOled.clearDisplay(); myOled.setTextCursor(1, 5); myOled.printf("<<< UNIST DHE: %u >>>",n++); myOled.display(); wait(0.1); } }