저는 Arduino 프로젝트에서 일하고 있으며 arduino Serial 이벤트로 Serial port
에서 일부 명령을 수신하고 싶습니다. 그러나 그것은 항상 일련의 이벤트가 완료되었음을 모르는 코드를 작성하는 조건을 충족시키지 않습니다. 여기 내 코드가있다.Arduino 직렬 이벤트가 반환되지 않습니다.
void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
if (inChar == '`')
{
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '|') {
settingsReceived = true; // <----- This will never be called
Serial.println("true"); // <------ Nor this will too
}
}
}
}
나는 시리얼 모니터에서 문자열 `Hello|
을 전달하려고했습니다 아직이 응답하지 않습니다. 또한 Line ending
을 No Line Ending
및 Newline
으로 시도했지만 아직 작동하지 않습니다. 아무도 도와 줄 수 있습니까? 감사!
재미 있고, 하드웨어의 멋진 작은 조각! – JackCColeman
haha itz true;] –