In this video lesson we show you how to measure temperature and humidity using the DHT11 sensor. For your convenience, we include the code below which we develop in the above video. Enjoy!
Arduino
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
#include <DHT.h>
#define DHTPIN 11
#define DHTTYPE DHT11
DHTmyDHT(DHTPIN,DHTTYPE);
intbr=115200;
intsetUpDelay=1000;
intmeasDelay=1000;
floattempC;
floattempF;
floathum;
floatHIF;
floatHIC;
Stringmessage;
voidsetup(){
// put your setup code here, to run once:
Serial.begin(br);
myDHT.begin();
delay(setUpDelay);
}
voidloop(){
// put your main code here, to run repeatedly:
tempC=myDHT.readTemperature(false);
tempF=myDHT.readTemperature(true);
hum=myDHT.readHumidity();
if(isnan(tempC)||isnan(tempF)||isnan(hum)){
Serial.println("Failed to Read Data on DHT11");
return;
}
HIC=myDHT.computeHeatIndex(tempC,hum,false);
HIF=myDHT.computeHeatIndex(tempF,hum,true);
message="Temp: "+String(tempC)+" deg C "+String(tempF)+" deg F Humidity: "+String(hum)+" % Heat Index: "+String(HIC)+" deg C "+String(HIF)+" deg F.";
In this lesson we demonstrate using both cores on the Raspberry Pi Pico W. The program controls a servo from a push button. The servo is controlled on the second core by a thread, and the push button is monitored in the main program.
In this lesson we show how to get intuitive calibrated results from a joystick, connected to a Raspberry Pi Pico W, using microPython. This lesson will make it easy to incorporate a joystick into Pico W projects.
For your convenience, the code we develop in the video above is included below.
This lesson describes how to add RFID Tag capability to the Raspberry Pi. we will be using the MFRC522 RFID Module. The schematic below shows how to connect the device up to the Raspberry Pi through a standard breakout board.
Making The World a Better Place One High Tech Project at a Time. Enjoy!