Digital In/Out

This object can be used to interface with digital devices that are not explicitly supported. The same object works with digital inputs as well as digital outputs.

DIGITAL provides interfaces for controlling a digital input / output pin.

Add Input Device

Item

Description

Digital In

Returns the current state of the digital pin connected to the DIGITAL object, or the cached state of the digital output value last SET to the object.

Add Output Device

Item

Description

Digital Out

Interfaces for controlling a digital output.

set(val): Sets the digital output to the value specified by "val" (0 or 1).
on(): Sets the state of the digital output to high (1).
off(): Sets the state of the digital output to low (0).

CE products: from digital import *

TI-Nspire CX II: from ti_hub import *

 

 

The function to create the object is pasted from the menu.

var=digital("port")

Command:

var=digital("port")

Command
Syntax:

var=digital("port")

Range:

Describe:

This object can be used to interface with digital devices that are not explicitly supported.

Result:

Type or
Addressable
Component:

Control

 

var.measurement()

Command:

var.measurement()

Command
Syntax:

var.measurement()

Python
Code
Sample:

TI Nspire CX II:

from ti_hub import *

d1 = digital("IN 1")

val = d1.measurement()

print("Value is: ", val)

 

CE products:

from digital import *

d1 = digital("IN 1")

val = d1.measurement()

print("Value is: ", val)

Range:

Describe:

Reads the digital sensor and returns 0.0 or 1.0.

Result:

 

Type or
Addressable
Component:

Control

 

var.set(val)

Command:

var.set(val)

Command
Syntax:

var.set(val)

Range:

Describe:

Set the digital device to 0 or 1.

Result:

Type or
Addressable
Component:

Control

 

var.off()

Command:

var.off()

Command
Syntax:

var.off()

Range:

Describe:

Equivalent to "var.set(0)".

Result:

Type or
Addressable
Component:

Control

 

var.on()

Command:

var.on()

Command
Syntax:

var.on()

Range:

Describe:

Equivalent to "var.set(1)".

Result:

Type or
Addressable
Component:

Control