Chat freely about anything...

User avatar
By Diviner
#57930 I have searched and can't find if this is possible without special wiring.

I just want to read the Arduino IDE input Serial Monitor command line as a way to simulate http calls. I have Both NL & CL set and 9600.

The serial monitor has no problem displaying

Code: Select allString inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

EDIT:
Figured it out. Needed
  while (Serial.available() > 0)

void setup() {
  Serial.begin(9600);
  inputString.reserve(200);
}

void loop() {

  if (stringComplete) {
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  }
}

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}