---
tag: m0118
title: Serial print
brief: Send text to serial
author: thinkyhead
contrib: shitcreek, Teddyz

group: hosts

codes: [ M118 ]

notes:
  - The `E`, `A`, and `P` parameters must precede the message.
  - Can also send message to serial port.

parameters:
  -
    tag: string
    optional: true
    description: Message string. If omitted, a blank line will be sent.
  -
    tag: A1
    optional: true
    description: Prepend `// ` to denote a comment or action command. Hosts like OctoPrint can interpret such commands to perform special actions. See your host's documentation.
  -
    tag: E1
    optional: true
    description: Prepend `echo:` to the message. Some hosts will display echo messages differently when preceded by `echo:`.
  -
    tag: Pn
    optional: true
    description: Send message to host serial port (1-9).
    values:
      -
        tag: 0
        description: Send message to all ports.
      -
        tag: 1
        description: Send message to main host serial port.
      -
        tag: 2
        description: Send message to secondary host serial port. Requires `SERIAL_PORT_2`.

examples:
  -
    pre: Echo "Yello World!" in the console
    code: M118 E1 Yello World!
  -
    pre: Tell [OctoPrint](//docs.octoprint.org/en/master/features/action_commands.html) to cancel the print job
    code: M118 A1 action:cancel

---

Send a message to the connected host for display in the host console or to perform a host action.
