Convenience routines for an I"C connected LCD display. Handy things like taking cursor to home, positioning cursor, clearing display, writing strings etc
jtlcd.cpp
- Committer:
- jont
- Date:
- 2012-11-07
- Revision:
- 1:2ded47079af1
- Parent:
- 0:8f724a47a820
- Child:
- 2:5b220477045b
File content as of revision 1:2ded47079af1:
#include "mbed.h" #include "jtlcd.h" I2C i2c(p28, p27); // sda, scl void lcdinit() { i2c.start(); i2c.write(Slave); i2c.write(0x00); i2c.write(0x38); wait(0.01); i2c.write(0x39); //i assume now we juyst need data? wait(0.01); i2c.write(0x14); i2c.write(0x74); i2c.write(0x54); i2c.write(0x6f); i2c.write(0x0c); i2c.write(0x01); i2c.write(0x06); wait(0.01); i2c.stop(); } void lcdclear() { i2c.start(); i2c.write(Slave); i2c.write(0x00); i2c.write(0x01); i2c.stop(); wait(0.2); } void test() { i2c.start(); i2c.write(Slave); i2c.stop(); wait(0.2); } void Show(char *text) { int n;//,d; //d=0x00; int length = strlen(text); i2c.start(); i2c.write(Slave); //Slave=0x78 i2c.write(Datasend);//Datasend=0x40 for(n=0;n<length;n++){ i2c.write(*text); ++text; } i2c.stop(); }