dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
tempsensort.cpp@1:5c42ec7f1aeb, 2016-02-22 (annotated)
- Committer:
- sbh9428
- Date:
- Mon Feb 22 06:03:11 2016 +0000
- Revision:
- 1:5c42ec7f1aeb
- Parent:
- 0:9bfc4aea91e2
- Child:
- 10:c751a0e8b7f9
PID?;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sbh9428 | 0:9bfc4aea91e2 | 1 | /* |
sbh9428 | 0:9bfc4aea91e2 | 2 | * tempsensott.cpp |
sbh9428 | 0:9bfc4aea91e2 | 3 | * |
sbh9428 | 0:9bfc4aea91e2 | 4 | * Created on: 2016. 2. 19. |
sbh9428 | 0:9bfc4aea91e2 | 5 | * Author: sbh9428 |
sbh9428 | 0:9bfc4aea91e2 | 6 | */ |
sbh9428 | 0:9bfc4aea91e2 | 7 | |
sbh9428 | 0:9bfc4aea91e2 | 8 | #include "tempsensort.h" |
sbh9428 | 0:9bfc4aea91e2 | 9 | |
sbh9428 | 0:9bfc4aea91e2 | 10 | temp_sensor_t::temp_sensor_t() { |
sbh9428 | 0:9bfc4aea91e2 | 11 | // TODO Auto-generated constructor stub |
sbh9428 | 0:9bfc4aea91e2 | 12 | |
sbh9428 | 0:9bfc4aea91e2 | 13 | } |
sbh9428 | 0:9bfc4aea91e2 | 14 | |
sbh9428 | 1:5c42ec7f1aeb | 15 | temp_sensor_t::temp_sensor_t(AnalogIn* _temperature_sensor) |
sbh9428 | 0:9bfc4aea91e2 | 16 | { |
sbh9428 | 0:9bfc4aea91e2 | 17 | temperature_sensor=_temperature_sensor; |
sbh9428 | 0:9bfc4aea91e2 | 18 | } |
sbh9428 | 0:9bfc4aea91e2 | 19 | |
sbh9428 | 0:9bfc4aea91e2 | 20 | |
sbh9428 | 0:9bfc4aea91e2 | 21 | temp_sensor_t::~temp_sensor_t() { |
sbh9428 | 0:9bfc4aea91e2 | 22 | // TODO Auto-generated destructor stub |
sbh9428 | 0:9bfc4aea91e2 | 23 | } |
sbh9428 | 0:9bfc4aea91e2 | 24 | |
sbh9428 | 0:9bfc4aea91e2 | 25 | float temp_sensor_t::get_temp() |
sbh9428 | 0:9bfc4aea91e2 | 26 | { |
sbh9428 | 1:5c42ec7f1aeb | 27 | return (double)temperature_sensor->read_u16()/1024/64*165-40; |
sbh9428 | 0:9bfc4aea91e2 | 28 | } |