File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11
11
// #define DHTTYPE DHT21 // DHT 21 (AM2301)
12
12
13
13
// Connect pin 1 (on the left) of the sensor to +5V
14
+ // NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
15
+ // to 3.3V instead of 5V!
14
16
// Connect pin 2 of the sensor to whatever your DHTPIN is
15
17
// Connect pin 4 (on the right) of the sensor to GROUND
16
18
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
17
19
20
+ // Initialize DHT sensor for normal 16mhz Arduino
18
21
DHT dht (DHTPIN, DHTTYPE);
22
+ // NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
23
+ // might need to increase the threshold for cycle counts considered a 1 or 0.
24
+ // You can do this by passing a 3rd parameter for this threshold. It's a bit
25
+ // of fiddling to find the right value, but in general the faster the CPU the
26
+ // higher the value. The default for a 16mhz AVR is a value of 6. For an
27
+ // Arduino Due that runs at 84mhz a value of 30 works.
28
+ // Example to initialize DHT sensor for Arduino Due:
29
+ // DHT dht(DHTPIN, DHTTYPE, 30);
19
30
20
31
void setup () {
21
32
Serial.begin (9600 );
You can’t perform that action at this time.
0 commit comments