String comdata = ""; void setup() { Serial.begin(9600); } void loop() { while (Serial.available() > 0) { comdata += char(Serial.read()); delay(2); } if (comdata.length() > 0) { Serial.println(comdata); comdata = ""; } }
关键字词: