Sensiron SHT 7x Temperature and humidity device library
Dependents: temp xj-Nucleo-F303K8-SHT75-TEST
Diff: sht7X.h
- Revision:
- 2:dd218144f9fe
- Parent:
- 1:20aa2d4a28bf
- Child:
- 3:c6a7a49099fe
diff -r 20aa2d4a28bf -r dd218144f9fe sht7X.h --- a/sht7X.h Wed Oct 27 15:51:27 2010 +0000 +++ b/sht7X.h Wed Oct 27 16:09:11 2010 +0000 @@ -41,23 +41,39 @@ * calculate the liniarised humidity value. * #include "mbed.h" * #include "SHT7X.h" -00035 * -00036 * Servo myservo(p21); -00037 * -00038 * int main() { -00039 * while(1) { -00040 * for(int i=0; i<100; i++) { -00041 * myservo = i/100.0; -00042 * wait(0.01); -00043 * } -00044 * for(int i=100; i>0; i--) { -00045 * myservo = i/100.0; -00046 * wait(0.01); -00047 * } -00048 * } -00049 * } -00050 * @endcode -00051 */ +* +* SHT75 sht(p12, p11); +* Serial pc(USBTX, USBRX); +* +* int main() +* { +* float temperature; // temperature -40 to 120 deg C +* float humidity; // relative humidity 1% to 100% +* float humi_f,rh_li,rh_true; // working registers for Illustration purposes +* int t; // temporary store for the temp ticks +* int h; // temp store for the humidity ticks + +* pc.baud(115200); +* +* while(1) +* { +* sht.readTempTicks(&t); +* temperature = ((float)(t) * 0.01) - 39.61; +* +* sht.readHumidityTicks(&h); +* humi_f = (float)(h); +* rh_lin = C3 * humi_f * humi_f + C2 * humi_f + C1; +* rh_true=(((tv[a]/100)-25)*(T1+T2*humi_f)+rh_lin); +* if(rh_true>100)rh_true=100; //cut if the value is outside +* if(rh_true<1)rh_true=1; //the physical possible range +* huididty = rh_true; +* pc.printf("Temp: %2.2f RH %2.2f\n\r",temperature, humidity); +* } +* } +* } +* @endcode +*/ + class SHT75 { public: