SunFounder 3in1 Kit
(continued from previous page)
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
humidity = dht.readHumidity();
// Read temperature as Celsius (the default)
temperature = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return false;
}
return true;
}
With the Blynk Timer, the ambient temperature, humidity, light intensity and soil moisture are obtained every second
and sent to the data stream on the Blynk Cloud, from which the widgets display the data.
void myTimerEvent()
{
bool chk = readDHT();
int light = readLight();
int moisture = readMoisture();
if(chk){
Blynk.virtualWrite(V4,humidity);
Blynk.virtualWrite(V5,temperature);
}
Blynk.virtualWrite(V6,light);
Blynk.virtualWrite(V7,moisture);
}
6.7 7. Current Limiting Gate
Some situations, such as parking lots, require quantity management.
Here we create a smart gate: a servo is used as the gate, and an IR obstacle detector is placed in front of it; if an
object (like a car) is detected, the gate will open and the number will be increased by 1. The count is displayed with
a 7-segment display and is also uploaded to the Blynk Cloud for you to view remotely. Finally, Blynk has a Switch
widget to enable or disable this smart gate system.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name ITEMS IN THIS KIT LINK
3 in 1 Starter Kit 380+
You can also buy them separately from the links below.
316 Chapter 6. IoT Projects