a sample program to use oled_i2c library, to display float number on the OLED screen.
Dependencies: eeprom mbed oled_i2c
Revision 0:c35f30fe243b, committed 2018-06-19
- 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
diff -r 000000000000 -r c35f30fe243b eeprom.lib --- /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
diff -r 000000000000 -r c35f30fe243b main.cpp --- /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); +}
diff -r 000000000000 -r c35f30fe243b mbed.bld --- /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
diff -r 000000000000 -r c35f30fe243b oled_i2c.lib --- /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