Test temperature for the near space lab
Dependencies: SDFileSystem mbed TEMP_Test
Fork of RGB_Test by
TEMPSensor.cpp@4:4b67d7667474, 2016-03-16 (annotated)
- Committer:
- tdale19
- Date:
- Wed Mar 16 21:56:06 2016 +0000
- Revision:
- 4:4b67d7667474
- Parent:
- RGBSensor.cpp@1:e0fc716e2394
- Child:
- 7:b8647f72947c
First test of Temp sensors
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tdale19 | 4:4b67d7667474 | 1 | #include "TEMPSensor.h" |
tdale19 | 4:4b67d7667474 | 2 | #include "mbed.h" |
tdale19 | 4:4b67d7667474 | 3 | #include "TMP102.h" |
Jeriah | 0:547856de255b | 4 | // The location of the sensor on the FRDM-K64F// |
Jeriah | 0:547856de255b | 5 | |
tdale19 | 4:4b67d7667474 | 6 | I2C i2c(PTE25,PTE24); |
tdale19 | 4:4b67d7667474 | 7 | TMP102 thermometerInside(i2c,0x90); |
tdale19 | 4:4b67d7667474 | 8 | AnalogIn thermometerOutside1(PTB3); |
tdale19 | 4:4b67d7667474 | 9 | AnalogIn thermometerOutside2(PTC11); |
tdale19 | 4:4b67d7667474 | 10 | AnalogIn thermometerPanel1(PTB10); |
tdale19 | 4:4b67d7667474 | 11 | AnalogIn thermometerPanel2(PTC10); |
Jeriah | 0:547856de255b | 12 | |
tdale19 | 4:4b67d7667474 | 13 | float get_outsideTemp()//function to return temperature readings from outside thermometers not in contact with the panels |
tdale19 | 4:4b67d7667474 | 14 | { |
tdale19 | 4:4b67d7667474 | 15 | float outsideTemp = (thermometerOutside1.read()+ thermometerOutside2.read()) / 2; //average of two outside thermometer |
tdale19 | 4:4b67d7667474 | 16 | return outsideTemp; |
Jeriah | 0:547856de255b | 17 | } |
tdale19 | 4:4b67d7667474 | 18 | |
tdale19 | 4:4b67d7667474 | 19 | float get_insideTemp()//function to return data from inside on-boatd thermometer |
tdale19 | 4:4b67d7667474 | 20 | { |
tdale19 | 4:4b67d7667474 | 21 | float insideTemp = thermometerInside.read(); // onboard in-pod thermometer |
tdale19 | 4:4b67d7667474 | 22 | return insideTemp; |
tdale19 | 4:4b67d7667474 | 23 | } |
tdale19 | 4:4b67d7667474 | 24 | |
tdale19 | 4:4b67d7667474 | 25 | float get_panelTemp()//function to return data from the thermometers in contact with the solar panels |
tdale19 | 4:4b67d7667474 | 26 | { |
tdale19 | 4:4b67d7667474 | 27 | float panelTemp = (thermometerPanel1.read() + thermometerPanel2.read()) / 2; // average of two on-panel thermometer |
tdale19 | 4:4b67d7667474 | 28 | return panelTemp; |
tdale19 | 4:4b67d7667474 | 29 | } |