![](/media/cache/profiles/7acba01022004f2ce03bf56ca56ec6f4.50x50_q85.jpg)
use TMP102 with 2 line LCD HD44780
Dependencies: TextLCD mbed TMP102
main.cpp@0:a25ced1b3e2b, 2011-06-16 (annotated)
- Committer:
- GregMartin
- Date:
- Thu Jun 16 15:50:32 2011 +0000
- Revision:
- 0:a25ced1b3e2b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GregMartin | 0:a25ced1b3e2b | 1 | #include "mbed.h" |
GregMartin | 0:a25ced1b3e2b | 2 | #include "TextLCD.h" |
GregMartin | 0:a25ced1b3e2b | 3 | #include "TMP102.h" |
GregMartin | 0:a25ced1b3e2b | 4 | float val; |
GregMartin | 0:a25ced1b3e2b | 5 | TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground |
GregMartin | 0:a25ced1b3e2b | 6 | TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 but could use 27,28,29,30 instead of 17,18,19,20 |
GregMartin | 0:a25ced1b3e2b | 7 | int main() |
GregMartin | 0:a25ced1b3e2b | 8 | { |
GregMartin | 0:a25ced1b3e2b | 9 | while(1){ |
GregMartin | 0:a25ced1b3e2b | 10 | val=temperature.read(); |
GregMartin | 0:a25ced1b3e2b | 11 | printf("Temperature: %f\n", temperature.read()); |
GregMartin | 0:a25ced1b3e2b | 12 | //lcd.printf("%f \n",temperature.read()); |
GregMartin | 0:a25ced1b3e2b | 13 | lcd.printf("%f \n",val); |
GregMartin | 0:a25ced1b3e2b | 14 | |
GregMartin | 0:a25ced1b3e2b | 15 | wait(0.5); |
GregMartin | 0:a25ced1b3e2b | 16 | } |
GregMartin | 0:a25ced1b3e2b | 17 | return 0; |
GregMartin | 0:a25ced1b3e2b | 18 | } |