我试图将串行数据存储到一个数组,然后将所有数组转换为一个字符串,然后将其发送到服务器。但我不断收到“非类类型”错误
我正在排队的神一次响应一个字节。任何建议表示赞赏!
代码:
全选#include
int incomingByte[13] ; //array of data
String page1;
#define mdDeRe 14 // GPIO14 = D5 // sends signal to device.
ESP8266WebServer server(80);
void getdata1 (){
digitalWrite(mdDeRe, HIGH); /// enable receiver to receive data
Serial.write(17); ///// <<<---- maybe this can be written better
Serial.write(3);
Serial.write(0);
Serial.write(84);
Serial.write(0);
Serial.write(4);
Serial.write(7);
Serial.write(73);
Serial.flush();
digitalWrite(mdDeRe,LOW); //// enables device to send data
//// store received bytes into an array /////
if (Serial.available()) {
for (int i=0; i<13; i ++){
incomingByte = Serial.read();
}
}
/// Here I would like to send the whole array to server
page1 = incomingByte.toString();
server.send(200, "text/plane",page1); //sends data to server
}