I want to write a test that will be run on Arduino Uno. This test must check what was written my main application to Serial.
Is there a way to read from Serial what was written to eralier?
I want to write a test that will be run on Arduino Uno. This test must check what was written my main application to Serial.
Is there a way to read from Serial what was written to eralier?
No.
This test must check what was written my main application to Serial.
What do you really want to achieve?
What is the main application that you're referring to? Is that running on the Arduino or on something else (e.g. PC).
What volume of data written do you want to check ?
If it is relatively small you could save it at the time you send it so that you could reference it again later.
afedorov:
This test must check what was written my main application to Serial.
That is not clear.
What is the main application?
Is it sending data to the Arduino or is it receiving data from the Arduino?
If it is receiving data from the Arduino then the only way to check that the main application received the data correctly is to arrange for the main application to send the data back to the Arduino where it can be compared with a copy of the data that had been sent by the Arduino.
...R
So Arduino app sends some status via Serial to PC.
I want to check that it is doing it correctly. I use PlatformIO that (as I understand) allows me to upload my unit test(that is basically my app with some assertions) to the board and run it. So If I want to assert on Serial I am checking in from inside the board.
Should I test it outside of the app on my PC? Is there a good way to do it?
Should I test it outside of the app on my PC? Is there a good way to do it?
Any terminal emulator such as TeraTerm or even puTTY will allow you to see what is being sent across the serial interface to the PC