Orignal AVR Tiny USI Based I2C slave LCD Test Program.

Dependencies:   MyLCD mbed

Committer:
bant62
Date:
Thu Dec 12 01:39:07 2013 +0000
Revision:
0:69e0caf04cfd
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bant62 0:69e0caf04cfd 1 #include "mbed.h"
bant62 0:69e0caf04cfd 2 #include "MyLCD.h"
bant62 0:69e0caf04cfd 3
bant62 0:69e0caf04cfd 4 I2C i2c(dp5,dp27); // sda, scl <== LPC1114FN28
bant62 0:69e0caf04cfd 5 MyLCD lcd(&i2c);
bant62 0:69e0caf04cfd 6 DigitalOut led1(LED1);
bant62 0:69e0caf04cfd 7 DigitalOut led2(LED2);
bant62 0:69e0caf04cfd 8
bant62 0:69e0caf04cfd 9 char osamru_bitmap[6][8] =
bant62 0:69e0caf04cfd 10 {
bant62 0:69e0caf04cfd 11 { 4, 3, 15, 7, 15, 18, 18, 14}, // おさる その1
bant62 0:69e0caf04cfd 12 { 31, 31, 31, 31, 3, 0, 12, 18}, // おさる その2
bant62 0:69e0caf04cfd 13 { 0, 24, 28, 30, 18, 2, 12, 18}, // おさる その3
bant62 0:69e0caf04cfd 14 { 30, 15, 30, 12, 6, 2, 1, 0}, // おさる その4
bant62 0:69e0caf04cfd 15 { 22, 12, 0, 17, 24, 30, 1, 30}, // おさる その5
bant62 0:69e0caf04cfd 16 { 22, 12, 4, 18, 2, 4, 24, 0} // おさる その6
bant62 0:69e0caf04cfd 17 };
bant62 0:69e0caf04cfd 18
bant62 0:69e0caf04cfd 19 int main() {
bant62 0:69e0caf04cfd 20
bant62 0:69e0caf04cfd 21 // LCD の外字を登録
bant62 0:69e0caf04cfd 22 for (int i=0; i < 6;i++)
bant62 0:69e0caf04cfd 23 {
bant62 0:69e0caf04cfd 24 lcd.saveCustomCharacter(i, osamru_bitmap[i]);//
bant62 0:69e0caf04cfd 25 lcd.mapCustomCharacter(i,i);
bant62 0:69e0caf04cfd 26 }
bant62 0:69e0caf04cfd 27
bant62 0:69e0caf04cfd 28 lcd.clear();
bant62 0:69e0caf04cfd 29 lcd.hideCursor();
bant62 0:69e0caf04cfd 30
bant62 0:69e0caf04cfd 31 lcd.gotoCursor(0, 0);
bant62 0:69e0caf04cfd 32 lcd.printChar(0); // おさる その1
bant62 0:69e0caf04cfd 33 lcd.printChar(1); // おさる その2
bant62 0:69e0caf04cfd 34 lcd.printChar(2); // おさる その3
bant62 0:69e0caf04cfd 35 lcd.printStr(">Monkee LCD<");
bant62 0:69e0caf04cfd 36
bant62 0:69e0caf04cfd 37 lcd.gotoCursor(0, 1);
bant62 0:69e0caf04cfd 38 lcd.printChar(3); // おさる その4
bant62 0:69e0caf04cfd 39 lcd.printChar(4); // おさる その5
bant62 0:69e0caf04cfd 40 lcd.printChar(5); // おさる その6
bant62 0:69e0caf04cfd 41 lcd.printStr("[\265\273\331\300\336 \263\257\267\267!]"); // 8進表記すればカタカナも表示可
bant62 0:69e0caf04cfd 42
bant62 0:69e0caf04cfd 43 led1 = 1;
bant62 0:69e0caf04cfd 44 led2 = 0;
bant62 0:69e0caf04cfd 45 while(1) {
bant62 0:69e0caf04cfd 46 wait(1);
bant62 0:69e0caf04cfd 47 led1 = !led1;
bant62 0:69e0caf04cfd 48 led2 = !led2;
bant62 0:69e0caf04cfd 49 }
bant62 0:69e0caf04cfd 50 }