I am using Arduino Uno to read data from sensor and transfer the data to my esp8266 by using Rx and Tx pin, I have already tried reading the data in old Blynk app and everything is fine but I got problems in reading data from string in Blynk 2.0 for the data stream i have already changed it to string type . Thankyou
#define BLYNK_DEVICE_NAME "xxx"
#define BLYNK_AUTH_TOKEN "xxx"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
#include <SimpleTimer.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DHT.h>
#define BLYNK_PRINT Serial
String data;
String I;
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "xxx";
char pass[] = "xxx";
BlynkTimer timer;
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
String sdata;
String myString;
char rdata;
#define
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
float Fahrenheit=0;
void myTimerEvent()
{
Blynk.virtualWrite(V1, millis() / 1000);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L,sensorvalue1);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
DS18B20.begin();
timer.setInterval(1000L, getSendData);
dht.begin();
timer.setInterval(1000L, sendSensor);
}
void loop()
{
if (Serial.available() == 0 )
{
Blynk.run();
timer.run();
}
if (Serial.available() > 0 )
{
rdata = Serial.read();
myString = myString+rdata;
}
}
void sensorvalue1()
{
sdata = myString ;
Blynk.virtualWrite(V2,myString);
myString = "";
}