Main Content

GPIO Read

Read logical value of GPIO pin configured as input

Add-On Required: This feature requires the Embedded Coder Support Package for BeagleBone Black Hardware add-on.

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.

Caution

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.

  • GPIO Read block

Parameters

Pin

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 View pin map.

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.