我从 arduino 发送到 arduino 字符串(I2C),捕获并保存到 char[10]。当我将此变量与文本进行比较时,条件没有执行:-/而且我不知道为什么......
char dataRx[10] = "";
void DaemonReceiving(int howMany){
int index = 0;
while(Wire.available() > 0){
char c = Wire.read();
dataRx[index++] = c;
dataRx[index] = '\0';
}
Serial.println(dataRx);
if(dataRx == "HELLO"){
Wire.beginTransmission(1);
Wire.write("HI");
Wire.endTransmission();
}
}