Projectlab Elektronica-ICT KULeuven
Dependencies: EthernetInterface TMP102 TextLCD mbed-rtos mbed
Temperature.cpp@4:466d859bfb13, 2014-03-17 (annotated)
- Committer:
- seppeduwe
- Date:
- Mon Mar 17 18:40:46 2014 +0000
- Revision:
- 4:466d859bfb13
- Parent:
- 3:344115c04cd0
Einde Labo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
seppeduwe | 1:635e76c52151 | 1 | #include "mbed.h" |
seppeduwe | 1:635e76c52151 | 2 | #include "Temperature.h" |
seppeduwe | 1:635e76c52151 | 3 | #include "TMP102.h" |
seppeduwe | 1:635e76c52151 | 4 | Temperature::Temperature() |
seppeduwe | 1:635e76c52151 | 5 | { |
seppeduwe | 1:635e76c52151 | 6 | temperature= new TMP102(p28, p27, 0x90); //A0 pin is connected to ground |
seppeduwe | 1:635e76c52151 | 7 | } |
seppeduwe | 1:635e76c52151 | 8 | |
seppeduwe | 1:635e76c52151 | 9 | //set the text on the display |
seppeduwe | 3:344115c04cd0 | 10 | float Temperature::getTemperature() |
seppeduwe | 1:635e76c52151 | 11 | { |
seppeduwe | 3:344115c04cd0 | 12 | return temperature->read(); |
seppeduwe | 3:344115c04cd0 | 13 | } |
seppeduwe | 3:344115c04cd0 | 14 | //Legacy code |
seppeduwe | 3:344115c04cd0 | 15 | int Temperature::getTemperature4095() |
seppeduwe | 3:344115c04cd0 | 16 | { |
seppeduwe | 3:344115c04cd0 | 17 | return (int) (37.227*(temperature->read()+25)); |
seppeduwe | 3:344115c04cd0 | 18 | |
seppeduwe | 1:635e76c52151 | 19 | } |