Sending GCode through serial

Hello,

I`m working on a project on which I need to synchronize my 3D printer movements with an external mechanism, and for that I am trying to develop a simple sketch where I can send GCode directly to the printer one line at a time and get feedback through the Serial Port.

I set up the connection port and the baud rate right, but when I send code (i.e. G28; or G28\n) the printer doesn't move and I get no response. Is it supposed to work like that? How can I make it work?

Thanks

Comments

  • That may work for a while. For example if you use Arduino serial monitor instead you can do exactly that. Newlines end lines so G28\n should home.

    Of course you are neglecting many things a host does e.g. waiting for "ok line" to see command was received so you do not flood firmware faster then it can handle and also no checksum and error handling.

    With repetier you can come away quite simple if you do not send line numbers/checksums wait for "ok" or "wait" (wait comes every second when no commands are waiting). But on transmission errors you get problems of course.
  • Thank you for the quick reply.

    Yes, if I use the Arduino Serial Monitor I can get it to work if the Serial is set to Newline, Carriage Return, or Both NL and CR, but it does not work when I try to send in the "No line ending" mode. I tried all the possibilities: G28, G28\n, G28\r, G28\r\n and G28\n\r but I get no "ok" or acknowledge from the system (when I send with the previous I get movement and the "ok 0" response, with the latter nothing works and I get "Resend: 1  ok" that keeps going indefinetely until I send a message again with the newline or carriage return"
  • You need line ending mode to send \n. If you enter it there in no ending mode I guess it will not convert it to newline but send 2 chars - backslash and n.
Sign In or Register to comment.