![](/media/cache/profiles/17a98ed636b0294602e63e75d11339a2.jpg.50x50_q85.jpg)
a sample program to use oled_i2c library, to display float number on the OLED screen.
Dependencies: eeprom mbed oled_i2c
Diff: main.cpp
- Revision:
- 0:c35f30fe243b
--- /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); +}