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

group: hosts

codes: [ M118 ]
related: [ M117 ]

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

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: P
  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 "Hello World!" to all ports
  code: M118 E1 P0 Hello 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.
