hcsr04_dht11 sicakliga gore degisim
Dependencies: mbed HCSR04 DHT11
main.cpp@0:c9bfe6d29b7f, 2019-12-28 (annotated)
- Committer:
- marvas
- Date:
- Sat Dec 28 10:49:54 2019 +0000
- Revision:
- 0:c9bfe6d29b7f
hcsr04_dht11 sicakliga gore degisim
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marvas | 0:c9bfe6d29b7f | 1 | #include "mbed.h" |
marvas | 0:c9bfe6d29b7f | 2 | #include "DHT11.h" |
marvas | 0:c9bfe6d29b7f | 3 | #include "hcsr04.h" |
marvas | 0:c9bfe6d29b7f | 4 | Timer t; |
marvas | 0:c9bfe6d29b7f | 5 | HCSR04 sensor(PA_9, PA_8); |
marvas | 0:c9bfe6d29b7f | 6 | DHT11 sinyal_pini(PB_13); |
marvas | 0:c9bfe6d29b7f | 7 | long sicaklik; |
marvas | 0:c9bfe6d29b7f | 8 | int main() |
marvas | 0:c9bfe6d29b7f | 9 | { |
marvas | 0:c9bfe6d29b7f | 10 | t.start(); |
marvas | 0:c9bfe6d29b7f | 11 | while(1) |
marvas | 0:c9bfe6d29b7f | 12 | { |
marvas | 0:c9bfe6d29b7f | 13 | long mesafe = sensor.distance(sicaklik); |
marvas | 0:c9bfe6d29b7f | 14 | printf("Mesafe %d\n ",mesafe); |
marvas | 0:c9bfe6d29b7f | 15 | wait_us(15); |
marvas | 0:c9bfe6d29b7f | 16 | if(t.read()>2) |
marvas | 0:c9bfe6d29b7f | 17 | { |
marvas | 0:c9bfe6d29b7f | 18 | sinyal_pini.readData(); |
marvas | 0:c9bfe6d29b7f | 19 | sicaklik=sinyal_pini.readTemperature(); |
marvas | 0:c9bfe6d29b7f | 20 | printf("Sicaklik:%d,Nem:%d \n", sicaklik,sinyal_pini.readHumidity()); |
marvas | 0:c9bfe6d29b7f | 21 | t.reset(); |
marvas | 0:c9bfe6d29b7f | 22 | } |
marvas | 0:c9bfe6d29b7f | 23 | } |
marvas | 0:c9bfe6d29b7f | 24 | } |