![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Kévin
main.cpp@0:1090ec9f109d, 2017-10-13 (annotated)
- Committer:
- Souleymane93
- Date:
- Fri Oct 13 13:15:22 2017 +0000
- Revision:
- 0:1090ec9f109d
Pour K?vin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Souleymane93 | 0:1090ec9f109d | 1 | #include "mbed.h" |
Souleymane93 | 0:1090ec9f109d | 2 | #include "DHT.h" |
Souleymane93 | 0:1090ec9f109d | 3 | |
Souleymane93 | 0:1090ec9f109d | 4 | Serial sig (PA_0, PA_1, 9600); |
Souleymane93 | 0:1090ec9f109d | 5 | DHT sensor(D6,SEN51035P); // Use the SEN11301P sensor |
Souleymane93 | 0:1090ec9f109d | 6 | |
Souleymane93 | 0:1090ec9f109d | 7 | int main() { |
Souleymane93 | 0:1090ec9f109d | 8 | for(int i=0; i<5; i++) { |
Souleymane93 | 0:1090ec9f109d | 9 | int err; |
Souleymane93 | 0:1090ec9f109d | 10 | int val; |
Souleymane93 | 0:1090ec9f109d | 11 | err = sensor.readData(); |
Souleymane93 | 0:1090ec9f109d | 12 | if(err == 0){ |
Souleymane93 | 0:1090ec9f109d | 13 | val = (int) sensor.ReadTemperature(CELCIUS); |
Souleymane93 | 0:1090ec9f109d | 14 | sig.printf("AT$SS=%02x\r\n",val); |
Souleymane93 | 0:1090ec9f109d | 15 | val = (int) sensor.ReadHumidity(); |
Souleymane93 | 0:1090ec9f109d | 16 | sig.printf("AT$SS=%02x\r\n",val); |
Souleymane93 | 0:1090ec9f109d | 17 | } |
Souleymane93 | 0:1090ec9f109d | 18 | wait(20); |
Souleymane93 | 0:1090ec9f109d | 19 | } |
Souleymane93 | 0:1090ec9f109d | 20 | } |
Souleymane93 | 0:1090ec9f109d | 21 |