0

I have a Uno program and I can transfer data to Processing using println. In Processing bufferUntil('\n') interprets the ln as \n, stops buffering, and reads the string until the next '\n'. I would like to use something other than ln to trigger Processing. That way I can use Serial Monitor in the Uno to see serial data when Processing is not running at the same time.

I have searched the net but have not found the technique to use something other than ln. Thanks.

2
  • ln? You mean \n aka new line character?
    – gre_gor
    Jun 25, 2017 at 21:18
  • 2
    Sounds like you want 2 programs monitoring the same serial port on the PC. What OS are you using? The question is not very clear.
    – 001
    Jun 26, 2017 at 3:06

1 Answer 1

2

If I understand your question (which is not certain):

  • Pick a different "trigger" byte that you won't be sending in your messages. Maybe TAB?
  • In your "Processing" program, use: port.bufferUntil(TRIGGER);
  • In your Arduino sketch, rather than println, use print to send both your data and the trigger byte: Serial.print(your_message); Serial.print(TRIGGER);

Note that sending binary data will cause this to fail when the data uses the trigger byte.

From: https://www.arduino.cc/en/Serial/Println The println() method sends your output then a CR and NL. And it seems bufferUntil() takes a character on which to trigger: https://processing.org/reference/libraries/serial/Serial_bufferUntil_.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.