Event trigger via M code?



  • I've gone through the list of M codes on the wiki and I haven't seen something that meets my needs...

    Since there doesn't seem to be anything specific for sending data out of the Duet via M code, I was thinking about using one of the fan outputs.

    The idea is to wire a fan output to an Arduino (of some sort) via an analog input. Then based on what the PWM level is set on the fan, the Arduino could take one or more different actions based on the input "voltage". I understand that I'll need a voltage divider circuit to keep from cooking the Arduino at the 12v the fan output can provide.

    Is there a better way of doing this?

    tnx!

    g.



  • You can use M118 https://duet3d.dozuki.com/Wiki/Gcode#Section_M118_Send_Message_to_Specific_Target to send a simple text message to DWC/USB/Telnet/UART.



  • That's excellent! The problem is that there's no hint in the description for setting a baud rate (for serial) or a target address (for http or telnet)...

    g.


  • administrators

    I didn't implement M118, but my understanding is this:

    • For the USB port, no baud rate is required
    • For the aux port, see M575
    • If the target it Telnet, the message will be sent to whatever Telnet client has logged on
    • If the target is HTTP, the message will be sent to all HTTP clients


  • @dc42 Ah, ok. Thanks.

    g.


Log in to reply