dwilches / Ardity

Assets for integrating Arduino and Unity (or Unity and any hardware that communicates over a COM port)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In Arduino, SUCCESS ->Serial.println("test"); FAIL -> Serial.print("test\n");

jeongcatfish opened this issue · comments

commented

Hi!
First, Thank you for share amazing code! It's really helpful.

I have some problem reading com port.
It's really working fine when I programed arduino like Serial.println("test");
but Serial.print("test\n"); isn't working..

How can I communicate not using Serial.println? just Serial.print

Thank you.!

Hello!

Thanks for using Ardity!

In Arduino, Serial.println prints the same string as Serial.print but followed by two extra characters: \r and \n. So in order to use Serial.print in your example, you should do:

Serial.print("test\r\n");

Source: https://www.arduino.cc/reference/en/language/functions/communication/serial/println/

Regards.