Terminal mode allows direct communications with the serial port.
•Checking "Terminal" in the window will enable terminal mode.
•The serial port control must be named "serial".
•Data entered in the Debug/Immediate window is sent as a string ending with a \n\r.
•Data from the controller must end in \n\r to be displayed.
•No data, to or from the serial port, will be otherwise processed by MPJ.
Example code to receive and send data back to MPJ:
if (Serial.available()){
delay(10); // allow serial data to fully arrive
unsigned int x = Serial.parseInt(); // accept decimal data
Serial.println(x); // send it back to MPJ
while(Serial.available()) // Flush the buffer
int b = Serial.read();
}
|