GPIO Read

Read logical value of GPIO pin configured as input

Description

Use this block to:

  • Create a physical input from a GPIO pin.

  • Read the logical value of the GPIO pin at intervals that are determined by Sample time.

  • Send the logical value to other blocks in the model as a stream of boolean values.

  • The maximum input voltage of the GPIO pin is 1.8 V.

Warning

You can damage your target hardware by:

  • Shorting a GPIO pin to ground.

  • Shorting a GPIO pin with high voltage to another GPIO pin with low voltage.

  • Connecting a GPIO pin to a voltage source greater than the maximum voltage.

  • Exceeding the maximum current by driving multiple GPIO pins high simultaneously.

Parameters

Board

Select the specific board you are using. You can find this information on the target hardware, product packaging, or product documentation.

Changing Board updates the GPIO number choices and the View pin map diagram.

You can print the pin map to refer to it later.

GPIO number

After selecting the Board, select the number of the GPIO pin. Do not use the same GPIO number in multiple blocks within a model.

To see the locations of the GPIO pins on the target hardware, click the View pin map button.

Sample time

Select the sample time for reading the state of the GPIO pin. This parameter value defaults to 1/10 second.

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