Mcode include multiple platform.Message command

  • Hi,
    I use duet borad M118 to connect to arduino.
    I want send mutiple commands,but finally arduino only get one command.
    Can you help me?
    The code is shown below.

  • administrators

    I don't see any reason why both messages would not be transmitted. Perhaps the problem is at the Arduino end? Is it set up to recognise linefeed only as the line ending?

    BTW I have some suggestions for improvement:

    1. Simplify it to:

    platform.Message(type, "M842 A(....)\n";
    platform.MessageF(type, "M842 A(...vel %d)\n", _value);

    [I've not filled in all the detail, you posted an image so I can't cut and paste from it)

    1. It's not nice to have a delay(1500) in there because it will suspend processing from all GCode input sources for the duration of the delay. Better to have the Arduino insert the delay. Alternatively, there is a built-in mechanism that can insert a delay at the RRF end without suspending other GCode sources.

    2. When you have finished debugging this, instead of using GenericMessage I suggest you use the MessageType that only sends to the Arduino.

  • @dc42 Thank you very much.

Log in to reply