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.