Welcome to mirror list, hosted at ThFree Co, Russian Federation.

M042.md « _gcode - github.com/MarlinFirmware/MarlinDocumentation.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 450917a02d63e52e862cee6bb8fcaf2d6de55e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
tag: m0042
title: Set Pin State
brief: Set an analog or digital pin to a specified state.
author: thinkyhead

group: control

codes: [ M42 ]

notes:

parameters:
  -
    tag: I
    optional: true
    since: 1.1.9.1
    description: Ignore protection on pins that Marlin is using.
    values:
      -
        type: bool
  -
    tag: T
    optional: true
    since: 2.0.5.2
    description: Set the pin mode. Prior to Marlin 2.0.9.4 this is set with the `M` parameter.
    values:
      -
        tag: 0
        description: '`INPUT`'
      -
        tag: 1
        description: '`OUTPUT`'
      -
        tag: 2
        description: '`INPUT_PULLUP`'
      -
        tag: 3
        description: '`INPUT_PULLDOWN`'
  -
    tag: P
    optional: true
    description: A digital pin number (even for analog pins) to write to. (`LED_PIN` if omitted)
    values:
      -
        tag: pin
        type: int
  -
    tag: S
    optional: false
    description: The state to set. PWM pins may be set from 0-255.
    values:
      -
        tag: state
        type: int

examples:
  -
    pre: Turn the LED pin on
    code: M42 S1
  -
    pre: Turn on pin 33
    code: M42 P33 S1
  -
    pre: Set pin 44 to do PWM with 50% DC
    code: M42 P44 S128

---

For custom hardware not officially supported in Marlin, you can often just connect up an unused pin and use [`M42`](/docs/gcode/M042.html) to control it.