-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDHT22.ino
More file actions
51 lines (45 loc) · 1.23 KB
/
DHT22.ino
File metadata and controls
51 lines (45 loc) · 1.23 KB
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
/*
[BLUEPILL Pinout]
----------
BAT-| STM32F |-3V3
LED=PC13-| 103C |-GND
OSC32IN=PC14-| |-5V
OSC32OUT=PC15-| |-PB9(~)
PA0(~)-| |-PB8(~)
PA1(~)-| |-PB7(~)=SDA
PA2(~)-| |-PB6(~)=SCL
PA3(~)-| |-PB5
NSS=PA4-| |-PB4
SCK=PA5-| |-PB3
MISO=PA6(~)-| |-PA15
MOSI=PA7(~)-| |-PA12=USB+
PB0(~)-| |-PA11=USB-
PB1(~)-| |-PA10(~)=RX
PB10-| |-PA9(~)=TX
PB11-| |-PA8(~)
NRST-| |-PB15
3V3-| |-PB14
GND-| -- |-PB13
GND-| | | |-PB12
----------
*/
#include <DHT.h>
#define DHTPIN PB12
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin();
dht.begin();
}
void loop()
{
float humi = dht.readHumidity();
float temp = dht.readTemperature();
Serial.print("temperature:");
Serial.print(temp);
Serial.print("\t");
Serial.print("humidity:");
Serial.println(humi);
delay(1000);
}