hello i am a student doing an iot project for the first time (ive done a few arduino projects). i want to make an environmental monitoring system with dht11 and soil moisture sensors. ive been watching online tutorials and im using a source code from a youtube video, however, ive run into the problem where the code can be uploaded, but my blynk io interface is still offline. im using my iphone hotspot for the wifi ssid, (ive turned on maximise compatibility) and i think that could be the main problem, since its like kinda stuck after writing trying to connect to my hotspot in the serial monitor. any help would be greatly appreciated!
this is the source code:
//Tech Trends Shameer
#define BLYNK_TEMPLATE_ID "TMPLIAjddf20T5"
#define BLYNK_DEVICE_NAME "Temperature and Humidity Monitor"
#define BLYNK_AUTH_TOKEN "122RywymdfdddgGfMd1jkZ0STNhRQecR12ayq"
#define BLYNK_PRINT Serial
#include <WiFi.h>
//#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = ""; // type your wifi name
char pass[] = ""; // type your wifi password
BlynkTimer timer;
#define DHTPIN 27 //Connect Out pin to D2 in NODE MCU
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V0, t);
Blynk.virtualWrite(V1, h);
Serial.print("Temperature : ");
Serial.print(t);
Serial.print(" Humidity : ");
Serial.println(h);
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
dht.begin();
timer.setInterval(100L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}