Guest
#6073848
First of all i want to say hello I have a problem with my DHT22 temperature and humidity sensor. The start signal is fine, the sensor response signal is fine, the bits that the sensor sends me are fine my problem is how can i read out the data that the sensor sends me because my values are 2700 for humidity and between 4500 and 5800 for temperature. As you will see in the attatched file, i hope it works this is my first post, i have tried it using a for loop and after the sensor pulls the data line to 0 for the 50us low voltage that comes before every bit, i will put the datasheet down below, i wait until the data line gets pulled high and because a 0 will be 26-28us high i wait for 40us and if it is still high i will write a 1 otherwise i will write a 0 in the variable. Data Sheet: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf A bit more information about the protocol: https://www.waveshare.com/wiki/DHT22_Temperature-Humidity_Sensor I will also put the code in here in case my attatched file doesnt work: I am using CodeBlocks to write my code
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |