MCreator Link: Ingame commands

Section

MCreator Link adds new /link command that can be used to interface with the connected devices.

/link command

This command allows you to interface with the MCreator Link devices using Minecraft commands. This feature can be used by command blocks for basic operations such as checking a pin or setting a pin value. This way basic mechanisms for interaction between Minecraft and your hardware device can be made by only using MCreator Link without having the need to write custom mods.

The following sub-commands are supported:

/link command/alias [arguments]:
  • device/d: Prints the current connected device name and description.
  • pinmode/pm [pin] [mode]: Sets the pin mode. Modes can be input/in, output/out, or input_pullup/in_p.
  • digitalwrite/dw [pin] [value:0/1]: Sets the value of the digital pin to the provided value that can be 0 or 1.
  • analogwrite/aw [pin] [value]: Sets the value of the analog pin to the provided value.
  • digitalread/dr [pin]: Returns the value of the provided digital pin.
  • analogread/ar [pin]: Returns the value of the provided analog pin.
  • sendmessage/sm [message]: Sends a custom message to the current MCreator Link device.

Examples

/link pinmode 13 output - Sets the mode of the pin 13 (onboard LED on most *duino boards) to output
/link digitalwrite 13 1 - Sets the pin 13 power state to high
/link ar 1 - Reads the value of the analog pin 1

Command blocks

One example would be to use a command block to digital write to the device. You can use a redstone signal to trigger this command to turn on one of the pins on the device. If you would like to turn it off when redstone turns off, use another negated redstone signal to another command block that turns off the digital pin.

Example setup

 



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.