I use gradle to upload tests on Arduino (a microcontoller). I can get the test output (on my ubuntu) through /dev/ttyUSB0.
I am looking now for the easiest way to get the test output in gradle. I have made some experiments with cat (ant.exec):
def checkTestResults = {
ant.exec(
outputproperty:"cmdOut",
errorproperty: "cmdErr",
resultproperty: "cmdExit",
failonerror:"true",
dir: './MyArduinoTests',
searchpath:"true",
executable: 'cat') {
arg(value:"/dev/ttyUSB0")
}
println ant.cmdOut
}
It does not work very well. I do not get the complete output of the serial port. Sometimes, I do not get any output.
How to accomplish this task without writing a separate program that reads the port?
The solution was to write a separate program that reads the port. My colleague wrote simply 8 line of python code.