hello i’m trying to send the temperature from the dht11 sensor by a websocket,
i’currently contructing a string containing the json but i have an error each time, please help me , the variable that gave me the problem is data1
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
char *t1 = (char *)t ;
char *h1 = (char *)h ;
WiFiClient client = server.available();
if (client.connected() && webSocketServer.handshake(client)) {
String data1;
while (client.connected()) {
// data = webSocketServer.getData();
// data1 = “{” + “\”temperature\””+ “:”+t1+”,”+”\”humidite\””+ “:”+h1″+”}”;
if (data1.length() > 0) {
Serial.println(data1);
webSocketServer.sendData(data1);
}