![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
first take
Fork of TextLCD_HelloWorld by
main.cpp@3:dfdc05f63423, 2014-11-03 (annotated)
- Committer:
- jn80842
- Date:
- Mon Nov 03 18:51:23 2014 +0000
- Revision:
- 3:dfdc05f63423
- Parent:
- 2:ad0b044d0a10
Project name and voltage displayed on LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:334327d1a416 | 1 | #include "mbed.h" |
simon | 0:334327d1a416 | 2 | #include "TextLCD.h" |
simon | 0:334327d1a416 | 3 | |
jn80842 | 3:dfdc05f63423 | 4 | DigitalOut led1(LED1); |
jn80842 | 3:dfdc05f63423 | 5 | |
jn80842 | 3:dfdc05f63423 | 6 | TextLCD lcd(D11,D10,D3,D2,D1,D0,TextLCD::LCD20x4); |
jn80842 | 3:dfdc05f63423 | 7 | |
jn80842 | 3:dfdc05f63423 | 8 | DigitalIn sda(PTE0); |
jn80842 | 3:dfdc05f63423 | 9 | DigitalIn scl(PTE1); |
jn80842 | 3:dfdc05f63423 | 10 | I2CSlave slave(PTE0, PTE1); |
jn80842 | 3:dfdc05f63423 | 11 | //AnalogIn vol(A0); |
jn80842 | 3:dfdc05f63423 | 12 | |
jn80842 | 3:dfdc05f63423 | 13 | //const int addr = 0x90; |
jn80842 | 3:dfdc05f63423 | 14 | char cmd[2]; |
jn80842 | 3:dfdc05f63423 | 15 | //slave.address = addr; |
jn80842 | 3:dfdc05f63423 | 16 | |
simon | 0:334327d1a416 | 17 | |
simon | 0:334327d1a416 | 18 | int main() { |
jn80842 | 3:dfdc05f63423 | 19 | led1=1; |
jn80842 | 3:dfdc05f63423 | 20 | sda.mode(PullUp); |
jn80842 | 3:dfdc05f63423 | 21 | scl.mode(PullUp); |
jn80842 | 3:dfdc05f63423 | 22 | cmd[0] = '?'; |
jn80842 | 3:dfdc05f63423 | 23 | cmd[1] = '!'; |
jn80842 | 3:dfdc05f63423 | 24 | slave.address(0x90); |
jn80842 | 3:dfdc05f63423 | 25 | while(true) { |
jn80842 | 3:dfdc05f63423 | 26 | led1=!led1; |
jn80842 | 3:dfdc05f63423 | 27 | //float val = 3.3*vol; |
jn80842 | 3:dfdc05f63423 | 28 | slave.read(cmd,2); |
jn80842 | 3:dfdc05f63423 | 29 | lcd.printf("Toastboard!\n"); |
jn80842 | 3:dfdc05f63423 | 30 | lcd.printf("%s\n",cmd); |
jn80842 | 3:dfdc05f63423 | 31 | wait(1); |
jn80842 | 3:dfdc05f63423 | 32 | } |
jn80842 | 3:dfdc05f63423 | 33 | |
simon | 0:334327d1a416 | 34 | } |