我正在使用 Ciseco srf 模块,试图从 arduino nano 发送“+++”。我的代码是
bool b =false;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.write('+');// Ihave tried Serial.write("+++")
Serial.write('+');// but this sends "+++<CR>" :(
Serial.write('+');
}
void loop() {
String content = "";
char character;
if(!b)
{
//Serial.print("sent");
b = true;
}
while(Serial.available()) {
character = Serial.read();
content.concat(character);
}
if (content != "") {
Serial.println(content);
}
}
<CR>
问题是 Arduino 似乎发送回车 Serial.write("+++")
或其他组合。有人可以帮我关闭 Arduino 上的回车并严格编程串行通信吗?