Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version
NodeMCU 0.9, ESP8266, BLYNK 1.1.0 packages, Android mobile and windows laptop.
#define BLYNK_TEMPLATE_ID "TMPL8Lro23R4"
#define BLYNK_DEVICE_NAME "Plant Watering System"
#define BLYNK_AUTH_TOKEN "kCAsn7BHLiOQR39b3siLn8cdVq6QIiD1"
#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS D2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char auth[] ="kCAsn7BHLiOQR39b3siLn8cdVq6QIiD1";
char ssid[] = "Atomix";
char pass[] = "plantwateringsystem";
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V5, h); //V5 is for Humidity
Blynk.virtualWrite(V6, t); //V6 is for Temperature
}
void setup()
{
Serial.begin(9600);
dht.begin();
timer.setInterval(1000L, sendSensor);
Blynk.begin(auth, ssid, pass);
sensors.begin();
}
int sensor=0;
int output=0;
void sendTemps()
{
sensor=analogRead(A0);
output=(145-map(sensor,0,1023,0,100)); //in place 145 there is 100(it change with the change in sensor)
delay(1000);
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
Serial.println(temp);
Serial.print("moisture = ");
Serial.print(output);
Serial.println("%");
Blynk.virtualWrite(V1, temp);
Blynk.virtualWrite(V2,output);
delay(1000);
}
void loop()
{
Blynk.run();
timer.run();
sendTemps();
}
So the code above was for a plant watering system project, i did that after watching some old tutorials as i’m very new to IoT and Blynk as well.
In my serial monitor its showing like this …
This is the Blynk Legacy server.
You haven’t bothered to fill-in any of the requested information, just kept the questions without any answers, so it’s difficult to tell if you are usingLegacy or not, but these lines suggest you are using Blynk IoT…
But, you’re missing the Template ID information, and without that the compiler will assume that it’s a Legacy sketch.
I’m extremely sorry ,
actually when i was copying the code it didn’t copy completely i have edited that as soon as i saw it. And the template ID was already present in the code
I’m sorry about that.
Also yes I’m using Blynk IoT here but its still connecting to the blynk legacy software from the beginning. I have changed the code multiple times yet its not connecting to blynk 2.0
Hi @PeteKnight , would you suggest something regarding this issue, I’m kind of in a hurry regarding this. You suddenly went offline so i wanted to know if there’s a fix for this which can resolve asap. I’m sorry for rushing you.
Thanks
Bhavesh
Well that’s not going to work unless you have a Blynk IoT server sitting on your home network at 192.168.1.100 - which you obviously don’t have.
Stop making changes that you don’t understand and go back to using Blynk.begin(auth, ssid, pass);
If the sketch you posted did actually create the serial output you posted in post #1 then the issue can only relate to the position of the #define BLYNK_TEMPLATE_ID and #define BLYNK_DEVICE_NAME lines of code within your sketch.
Your sketch has multiple other issues - duplicated auth token, use of SimpleTimer, use of delays and calling sendTemps(); from your void loop, all of which will need to be fixed, but you need to start by resolving the fact that it’s trying to connect to the Legacy server.
I have already said that i have seen your thread regarding it. The one you posted. and the positions of those lines are correct according to what you have told me.
That’s why i’m here asking you. I can’t resolve it.
I didn’t get this one, what’s with duplicated auth token ?