sample program using TextLCD_ostream
Dependencies: TextLCD_ostream mbed
This is sample program using std::ostream with TextLCD
Because a large amount of memory is needed, it does not work in low memory MPU.
(It works fine on mbed LPC1768 and STM32 Nucleo-L476RG. But linker error occard on TG-LPC11U35-501)
Diff: main.cpp
- Revision:
- 0:52f56aefba64
- Child:
- 1:2775f5dc2099
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jun 18 08:57:17 2016 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "TextLCD_ostream.h" + +I2C i2c(p28,p27); // SDA, SCL +TextLCD_I2C_N lcd(&i2c, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); +lcd_ostream lcds(&lcd); + +int main() { + using namespace std; + lcd.setContrast(32); + while(true) { + lcds << cls << "Hello world" << endl << "count: "; + for(int i=3; i>=0; i--) { + lcds.locate(8,1) << i; + wait(1); + } + wait(3); + lcds << cls; + for(int i=0; i<10; i++) { + lcds << "line:" << i << endl; + wait(1); + } + wait(5); + } +}