a sample program to use oled_i2c library, to display float number on the OLED screen.

Dependencies:   eeprom mbed oled_i2c

Files at this revision

API Documentation at this revision

Comitter:
poushen
Date:
Tue Jun 19 05:27:24 2018 +0000
Commit message:
add code to display float to OLED screen

Changed in this revision

eeprom.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
oled_i2c.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eeprom.lib	Tue Jun 19 05:27:24 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/poushen/code/eeprom/#8ddab67b62c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 19 05:27:24 2018 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "oled_i2c.h"
+#include "oled_font.h"
+
+DigitalOut myled(LED2);
+
+// make oled_i2c instance using I2C object.
+// with default slave address 0x78 (0x3C in 7bit format)
+// test ok with SSD1306 I2C 128*64 oled screen
+I2C i2c(dp5,dp27);   // for LPC1114 or LPC1115
+oled_i2c oled(i2c);
+
+int main()
+{
+    myled = 1;
+    printf("LPC1114 demo \r\n");
+    
+    i2c.frequency(1000 * 1000);
+    oled.init_oled();
+
+    oled.setFont(BigNumbers);
+    //oled.print("27", 20, 10);
+    //oled.printNumI(27, 0, 0);
+    oled.printNumF(27.45, 2, 0, 0);
+    oled.setFont(SmallFont);
+    oled.print("~c", 60, 30);
+    oled.update();
+
+    myled = 0;
+    while(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 19 05:27:24 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oled_i2c.lib	Tue Jun 19 05:27:24 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/poushen/code/oled_i2c/#c928953247eb