Digital Input

Read the digital value of an input pin

Library

Simulink Coder Support Package for ARM Cortex-based VEX Microcontroller/Sensors

Description

Read the digital or logical value (1 or 0) of the selected digital port (pin). You can use up to 12 digital IO pins on the VEX microcontroller. For information on the digital pin layout of the microcontroller, see VEX Cortex Pin-out.

During simulations, without the hardware, this block emits zeroes if no Source block is connected to the simulation input port. See Block Produces Zeros or Does Nothing in Simulation (Simulink). To achieve simulation behavior, connect a Source block from the Utilities library in VEX Microcontroller library.

During code generation, any simulation block that is connected to the input port of the Digital Input block is ignored and has no effect on the generated code.

It is possible that the code generated from this block does not work properly. If the VEX microcontroller is connected to a PC using the orange USB A to A cable and has no active VEX 7.2V battery connected, the VEX battery provides power to sensors.

Parameters

Digital Port

Select a digital pin (or port), a value between 1 and 12.

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

Add input port for simulation

Select this check box to simulate the digital input block.

Sample time

Specify how often this block should read the digital pin value, in seconds. This parameter value defaults to 1/5 second. If you select Add input port for simulation check box, the Sample time parameter is hidden and the value is inherited (Sample time = -1).