mbed display

Dependencies:   mbed ssd1306_library

Files at this revision

API Documentation at this revision

Comitter:
RCMISbed
Date:
Tue Oct 16 05:23:48 2018 +0000
Commit message:
mbed ssd1306

Changed in this revision

mbed.bld Show annotated file Show diff for this revision Revisions of this file
oled.cpp Show annotated file Show diff for this revision Revisions of this file
ssd1306_library.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 79fcf18a9ae5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 16 05:23:48 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02
\ No newline at end of file
diff -r 000000000000 -r 79fcf18a9ae5 oled.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oled.cpp	Tue Oct 16 05:23:48 2018 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "ssd1306.h"
+
+I2C i2c(p28, p27);
+
+//Host PC Baudrate (Virtual Com Port on USB)
+#define usbBR            115200
+//#define oled_adr         0x3C
+#define oled_adr         0x78
+// mbed Interface Hardware definitions
+DigitalOut l1(LED1);
+DigitalOut l2(LED2);
+DigitalOut l3(LED3);
+DigitalOut l4(LED4);
+
+// Host PC Communication channels
+Serial usb(USBTX, USBRX); // tx, rx
+SSD1306 oled(p28, p27,oled_adr);
+//SSD1306 oled(&i2c,oled_adr);
+
+int status1 = 0, status2 = 0;
+
+
+int init(void){
+    usb.baud(usbBR); wait(0.3);
+   i2c.frequency(400000); wait(0.3);
+    usb.printf("Bonjour ..... OLED SSD1306\r\n");
+
+    l1= 1; l2= 0; l3= 0; l4= 0; wait(0.5);
+    l1= 0; l2= 1; l3= 0; l4= 0; wait(0.5);
+    l1= 0; l2= 0; l3= 1; l4= 0; wait(0.5);
+    l1= 0; l2= 0; l3= 0; l4= 1; wait(0.5);
+    l1= 0; l2= 0; l3= 0; l4= 0; wait(0.5);
+    oled.speed(SSD1306::Medium);
+    oled.init();
+    oled.cls();
+    oled.locate(3,1);
+    oled.printf("Hello OLED !");
+    oled.line(6,22,114,22,SSD1306::Normal);
+    oled.line(114,22,114,33,SSD1306::Normal);
+    oled.line(114,33,6,33,SSD1306::Normal);
+    oled.line(6,33,6,22,SSD1306::Normal);
+    oled.fill(0,0);
+    oled.redraw();
+    return status1;
+    }
+
+int main(void){
+    status1= init();
+    while(true){
+        };
+    return status2;
+    }
diff -r 000000000000 -r 79fcf18a9ae5 ssd1306_library.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ssd1306_library.lib	Tue Oct 16 05:23:48 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/rodriguj/code/ssd1306_library/#57209a7e9cba