---
tag: m0240
title: Trigger Camera
brief: Trigger a camera shutter
author: thinkyhead

group: extras
requires: PHOTO_GCODE

codes: [ M240 ]

notes:
- "`CHDK_PIN` or `PHOTOGRAPH_PIN` is required prior to Marlin 2.0.0."
- To use the `CHDK_PIN` or `PHOTOGRAPH_PIN` option with a digital camera see [this article](//www.doc-diy.net/photo/rc-1_hacked/).
- To use an endstop or contact switch as a shutter switch for your smartphone's camera, see [this video](//youtu.be/i5g3ziK5wpI).

parameters:

- tag: A
  optional: true
  requires: PHOTO_POSITION
  description: Offset to the X return position.
  values:
  - tag: offset
    type: float

- tag: B
  optional: true
  requires: PHOTO_POSITION
  description: Offset to the Y return position.
  values:
  - tag: offset
    type: float

- tag: D
  optional: true
  requires: PHOTO_SWITCH_POSITION, PHOTO_SWITCH_MS
  description: Duration to hold down the shutter switch.
  values:
  - tag: ms
    type: int

- tag: F
  optional: true
  requires: PHOTO_POSITION
  description: Feedrate for the main photo moves. If omitted, the homing feedrate will be used.
  values:
  - tag: feedrate
    type: float

- tag: I
  optional: true
  requires: PHOTO_SWITCH_POSITION
  description: Shutter switch X position. If omitted, the photo move X position applies.
  values:
  - tag: pos
    type: float

- tag: J
  optional: true
  requires: PHOTO_SWITCH_POSITION
  description: Shutter switch Y position. If omitted, the photo move Y position applies.
  values:
  - tag: pos
    type: float

- tag: P
  optional: true
  requires: PHOTO_SWITCH_POSITION, PHOTO_SWITCH_MS
  description: Delay after pressing the shutter switch.
  values:
  - tag: ms
    type: int

- tag: R
  optional: true
  requires: PHOTO_POSITION
  description: Retract/recover length.
  values:
  - tag: length
    type: float

- tag: S
  optional: true
  requires: PHOTO_POSITION
  description: Retract/recover feedrate.
  values:
  - tag: feedrate
    type: float

- tag: X
  optional: true
  requires: PHOTO_POSITION
  description: Main photo move X position.
  values:
  - tag: pos
    type: float

- tag: Y
  optional: true
  requires: PHOTO_POSITION
  description: Main photo move Y position.
  values:
  - tag: pos
    type: float

- tag: Z
  optional: true
  requires: PHOTO_POSITION
  description: Main photo move Z raise.
  values:
  - tag: length
    type: float

videos:
- i5g3ziK5wpI

---

Trigger a camera shutter using a digital pin or by bumping a physical switch.
