
lib_SHT11_example
main.cpp@0:dc00eac8d44a, 2017-06-06 (annotated)
- Committer:
- YSI
- Date:
- Tue Jun 06 14:09:04 2017 +0000
- Revision:
- 0:dc00eac8d44a
lib_SHT11_example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YSI | 0:dc00eac8d44a | 1 | #include "mbed.h" |
YSI | 0:dc00eac8d44a | 2 | #include "lib_SHT11.h" |
YSI | 0:dc00eac8d44a | 3 | |
YSI | 0:dc00eac8d44a | 4 | SHT11 capteur_HT; |
YSI | 0:dc00eac8d44a | 5 | //SHT11 capteur_HT(p30, p29, 2.0); //data, sck, periode_cycle_mesure |
YSI | 0:dc00eac8d44a | 6 | Serial pc(USBTX, USBRX); |
YSI | 0:dc00eac8d44a | 7 | |
YSI | 0:dc00eac8d44a | 8 | int main() |
YSI | 0:dc00eac8d44a | 9 | { |
YSI | 0:dc00eac8d44a | 10 | float Temperature_mesuree=0.0, Humidite_mesuree=0.0; |
YSI | 0:dc00eac8d44a | 11 | |
YSI | 0:dc00eac8d44a | 12 | while(1) |
YSI | 0:dc00eac8d44a | 13 | { |
YSI | 0:dc00eac8d44a | 14 | if((Temperature_mesuree != capteur_HT.lire_T()) || (Humidite_mesuree != capteur_HT.lire_H())) |
YSI | 0:dc00eac8d44a | 15 | { |
YSI | 0:dc00eac8d44a | 16 | capteur_HT.lire_T_H(&Temperature_mesuree, &Humidite_mesuree); |
YSI | 0:dc00eac8d44a | 17 | pc.printf("T=%f\tH=%f\r\n", Temperature_mesuree, Humidite_mesuree); |
YSI | 0:dc00eac8d44a | 18 | } |
YSI | 0:dc00eac8d44a | 19 | } |
YSI | 0:dc00eac8d44a | 20 | } |