Skip to content

5 – DigitalOutputHelper component

DigitalOutputHelper owns one digital output pin and gives you three methods you can call from any UnityEvent:

Method What it does
On() Sets the pin HIGH
Off() Sets the pin LOW
Toggle() Flips it

Use it for LEDs, relays and buzzers.

The pin must be set to Digital Out in the device profile. In Set Up Arduino, set D13 to Digital Out and click Write Pins Into Profile (or create a new profile). Outputs need the Firmata transport.

  1. Create an empty GameObject, for example LED.
  2. Add Component > SerialInputBridge > Digital Output Helper.
  3. Set Pin to 13.
Field Meaning
Serial Manager Leave empty to use the one on this GameObject, or the first one in the scene.
Pin The output pin. It must be listed as Digital Out in the profile.
Send Only On Change Skip writes that would repeat the last value. Leave on.
Invert Send the opposite level. Use it for relay modules that switch on when the pin is LOW.
  1. Add a UI > Button to the scene.
  2. Under the button’s On Click (), click +, drag in the LED GameObject and choose DigitalOutputHelper > Toggle.

Press Play and click the button. The board’s LED switches on and off.

Combine it with DigitalInputEvent:

  • Digital ON → DigitalOutputHelper On
  • Digital OFF → DigitalOutputHelper Off

Now the LED follows the button on the board, through Unity.

Wire an SG90 servo →