我在做什么错
line = client.readStringUntil('\r');
和
if (line.substring(0) == "1");
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
line = client.readStringUntil('\r'); // String
Serial.println(line);
}
// Rele 1
if (line.substring(0) == "1")
{
Serial.println("Rele 1 ON");
digitalWrite(Rele_1, LOW);
myBr1 = 1;
}
else if (line.substring(0) == "0")
{
Serial.println("Rele 1 OFF");
digitalWrite(Rele_1, HIGH);
myBr1 = 0;
}
else
{
Serial.println("Rele 1 OFF the charts - Check what you give me....");
digitalWrite(Rele_1, HIGH);
myBr1 = 0;
}
当我运行此代码时,串行打印线给我:000 但继电器 1 给我:Rel 1 关闭图表 - 检查你给我的内容....如果我强制
line=001;
串行打印给我 1,而不是 001,我现在有 2 个继电器还有一点开始OTA更新。将添加更多继电器。我在混淆什么,我该如何纠正?