PR_2 DonghunKang
Dependencies: mbed Adafruit_GFX
Revision 0:5241b121daec, committed 2019-10-15
- Comitter:
- Donghun
- Date:
- Tue Oct 15 13:36:45 2019 +0000
- Commit message:
- Pr_2
Changed in this revision
diff -r 000000000000 -r 5241b121daec Adafruit_GFX.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adafruit_GFX.lib Tue Oct 15 13:36:45 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Donghun/code/Adafruit_GFX/#5b8321e0dcdf
diff -r 000000000000 -r 5241b121daec main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 15 13:36:45 2019 +0000 @@ -0,0 +1,179 @@ +#include "mbed.h" +#include "Adafruit_SSD1306.h" + +DigitalOut myled(LED1); + +#define PR_3 + +#ifdef Test +int main() +{ + I2C I2C_Oled(PB_7, PA_15); + I2C_Oled.frequency(400000); + + Adafruit_SSD1306_I2c myOled(I2C_Oled, PA_1); + myOled.splash(); + myOled.display(); + wait(0.5); + + myOled.clearDisplay(); + myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height()); + myOled.display(); + 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); + } +} +#endif + +#ifdef PR_1 +int main() +{ + I2C I2C_Oled(PB_7, PA_15); + I2C_Oled.frequency(400000); + + Adafruit_SSD1306_I2c myOled(I2C_Oled, PA_1); + myOled.splash(); + myOled.display(); + wait(0.5); + + myOled.clearDisplay(); + myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height()); + myOled.display(); + wait(1); + + while(1) + { + myOled.clearDisplay(); + myOled.setTextCursor(1,5); + myled = !myled; + + myOled.display(); + } +} +#endif + +#ifdef PR_2 +int main() +{ + I2C I2C_Oled(PB_7, PA_15); + I2C_Oled.frequency(400000); + + Adafruit_SSD1306_I2c myOled(I2C_Oled, PA_1); + myOled.splash(); + myOled.display(); + wait(0.5); + + myOled.clearDisplay(); + myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height()); + myOled.display(); + wait(1); + + while(1) + { + myOled.clearDisplay(); + myOled.setTextSize(3); + myOled.setTextColor(BLACK, WHITE); + myOled.setTextCursor(1,1); + myOled.printf("Read This?"); + myOled.display(); + wait(1); + myOled.clearDisplay(); + myOled.setTextSize(2); + myOled.setTextColor(BLACK, WHITE); + myOled.setTextCursor(1,1); + myOled.printf("How About This?"); + myOled.display(); + wait(1); + myOled.clearDisplay(); + myOled.setTextSize(1); + myOled.setTextColor(BLACK, WHITE); + myOled.setTextCursor(1,1); + myOled.printf("Really?"); + myOled.display(); + wait(1); + myOled.clearDisplay(); + myOled.setTextColor(WHITE); + myOled.setTextCursor(0,0); + myOled.setTextSize(1); + myOled.printf("A"); + myOled.setTextSize(2); + myOled.printf("A"); + myOled.setTextSize(3); + myOled.printf("A"); + myOled.setTextSize(4); + myOled.printf("A"); + myOled.setTextSize(5); + myOled.printf("A"); + myOled.setTextSize(6); + myOled.printf("A"); + myOled.display(); + wait(1); + myOled.clearDisplay(); + myOled.clearDisplay(); + myOled.drawRect(100, 10, 20, 20, WHITE); + myOled.display(); + wait(1); + myOled.fillRect(10, 10, 45, 15, WHITE); + myOled.display(); + wait(1); + myOled.drawRoundRect(60, 20, 35, 35, 8, WHITE); + myOled.display(); + wait(1); + myOled.drawCircle(60, 30, 30, WHITE); + myOled.display(); + wait(1); + myOled.fillCircle(100, 20, 5, WHITE); + myOled.display(); + wait(1); + myOled.fillCircle(70, 20, 5, WHITE); + myOled.display(); + wait(1); + myOled.drawTriangle(24, 1, 3, 55, 45, 55, WHITE); + myOled.display(); + wait(1); + myOled.fillTriangle(104, 62, 125, 9, 83, 9, WHITE); + myOled.display(); + wait(1); + } +} +#endif + +#ifdef PR_3 +int main() +{ + I2C I2C_Oled(PB_7, PA_15); + I2C_Oled.frequency(400000); + + Adafruit_SSD1306_I2c myOled(I2C_Oled, PA_1); + myOled.splash(); + myOled.display(); + wait(0.5); + + myOled.clearDisplay(); + myOled.printf("%u x %u OLED Display\r\n", myOled.width(), myOled.height()); + myOled.display(); + wait(1); + + static const unsigned char panda[] = +{ + +}; + while(1) + { + myOled.clearDisplay(); + myOled.drawBitmap(32,16,panda, 64, 32, WHITE); + myOled.display(); + wait(0.5); + } +} +#endif \ No newline at end of file
diff -r 000000000000 -r 5241b121daec mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 15 13:36:45 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file