Digital

API Documentation: [cpp] [python] [.NET] [LabVIEW]

BrainStem modules may have the ability to read, write or manipulate a digital pin. Digital I/O capabilities will be dictated by the module hardware being used. Module specifics that include the quantity of digital entities and details for their capacities will be described in that module’s datasheet.


Set/Get Configurations

Gets or Sets the digital pin configuration. Some digital entities may be single purpose functionality or can be configured for multiple behaviors depending on the hardware. Digital entities that are capable of different operating configurations can be explicitly set to operate in a desired configuration mode when possible. Defaults for most digital entities are typically as inputs, but will vary by module hardware.

stem.digital[index].setConfiguration(mode) [cpp] [python] [NET] [LabVIEW]
stem.digital[index].getConfiguration(mode) [cpp] [python] [NET] [LabVIEW]

The mode parameter is an integer that correlates to the following:

Value

Configuration

0

Input

1

Output

2

RC Servo Input

3

RC Servo Output

4

Hi Impedance (Hi-Z)

5

Input with Pull Down

Set/Get State

Gets or Sets the digital I/O Value. For gets the digital input state will be reported in a boolean fashion. Voltage threshold tolerance details for the target module will be described in the datasheet. For sets the digital output state will be asserted logic high or logic low. Voltage threshold details for the target module will be described in the datasheet.

stem.digital[index].setState(level) [cpp] [python] [NET] [LabVIEW]
stem.digital[index].getState(level) [cpp] [python] [NET] [LabVIEW]

If a digital pin is configured in Hi-Z mode its internal circuitry has been disconnected to create a high impedance. There are no functions that can act on this configuration

Pin

Input

Output

Hi-Z

RCServo

DIO 0

Yes

Yes

Yes

Input

DIO 1

Yes

Yes

Yes

Input

DIO 2

Yes

Yes

Yes

Input

DIO 3

Yes

Yes

Yes

Input

DIO 4

Yes

Yes

Yes

Output

DIO 5

Yes

Yes

Yes

Output

DIO 6

Yes

Yes

Yes

Output

DIO 7

Yes

Yes

Yes

Output

DIO 8

Yes

Yes

Yes

DIO 9

Yes

Yes

Yes

DIO 10

Yes

Yes

Yes

DIO 11

Yes

Yes

Yes

DIO 12

Yes

Yes

Yes

DIO 13

Yes

Yes

Yes

DIO 14

Yes

Yes

Yes