Problems again with my PID.
Im using ESP8266, Arduino IDE 1.6.4, windows 8.
I haven’t been able to try on other setups.
I’m reading a DS18B20 sensor and gets a value as double variable.
I’m converting it to a string for sending it to ThingSpeak.
Now i want it sent to a Value widget in the app. I found out that sending the double just gave an error value on the widget. I can successfully send it as an int, but i would like 1 decimals precision. So i tried sending the String value since i read it supported strings. But when i do that, the IDE stalls at compiling. (the Program still responds fully, just tries to compile forever)
As soon as i comment out the Blynk.virtualWrite(9, stringVariable); it compiles nicely.
I stripped the code for everything else. Still does it.
Can someone tell me why? or test it for me, to see if its on my side that somethings wrong.
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth";
double Input;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, "ssid", "pass");
}
void loop()
{
Blynk.run();
}
void writeData() {
//set temp string for Thingspeak
char t_buffer[10];
String temp = dtostrf(Input, 0, 1, t_buffer);
Blynk.virtualWrite(7, temp); // this line gives the error for me.
Serial.println(temp);
}
UPD: Looks like Arduino String object can’t be cast to regular char buffers, unfortunately.
Actually this is bad, cause now you would have to write something like this:
And this comes from Arduino documentation… Well that’s odd, as for me
Anyway looking at you particular example, it would be different a bit (this should work):
Sorry for late reply. But thx a lot. It works perfect. The way you wrote the code seems more simple than my version. I don’t understand the reason for writing it the way i did. i just followed some examples i found. But this way i think it even makes sense to me ;).
Hi
I write some codes for my ESP8266_DHT22 Project.It will display temperature Celsius string and Read humidity percent string in the virtualWrite function.