views:

610

answers:

2
A: 

To add the carriage return just append \r to your string, or perhaps, it may need a carriage return/linefeed \r\n, which some systems use to mark the end of line. Of course, it may only need a linefeed. In that case, you would simply use \n.

buffer = "M 3\r"

or

buffer = "M 3\r\n"

or

buffer = "M 3\n"

You might find the pySerial documentation of help in resolving your Windows issues.

tvanfosson
A: 

Unfortunately it doesn't work.
In the past I've already tried to use \r\n with the command echo in linux via bash... but nothing.
Now I'm trying with python but nothing again. It may be interesting that the instrument, when I give the string in this way:

buffer = "M 3\r"
or
buffer = "M 3\r\n"

gives to me this answer: @

That's all...
I don't know.
Another thing: when I've tried with the bash language the instrument begins the measure with the command:
echo "M 3 " > /dev/ttyS0
that is with a blanck after 3.
Obviously the other command don't work with this strange blanck...

Thank you very much!

Stefano