Documentation Center

  • Trial Software
  • Product Updates

Contents

Arduino Digital Input

Get logical value of digital input pin

Library

Simulink Support Package for Arduino® Hardware/Common

Description

Get the logical value of a digital pin on the Arduino hardware:

  • If the logical value of the digital pin is LOW, the block output emits 0.

  • If the logical value of the digital pin is HIGH, the block output emits 1.

The data type of the block output is uint8.

During simulations without the hardware, this block emits zeroes. See Block Produces Zeros or Does Nothing in Simulation

Dialog Box

Pin number

Enter the number of the digital pin.

Do not assign the same pin number to multiple blocks within the model.

If you set the Target hardware parameter to:

  • Arduino Mega 2560, enter a pin number from 0 to 53.

  • Arduino Uno, enter a pin number from 0 to 13.

  • Arduino Nano, enter a pin number from 0 to 13.

  • Arduino Due, enter a pin number from 0 to 53.

    Note:   To change the Target hardware parameter, select Tools > Run on Target Hardware > Options.

Sample time

Specify how often this block reads the pin value, in seconds. Enter a value greater than zero. This value defaults to a sample time of 1 second. The minimum value is 0.000001 second.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

See Also

| |

External Web Sites

Was this topic helpful?