Digital in|out

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).

The Digital (input | output) module is implemented as a Python class and has methods defined as:


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:

Creates an object for a digital device. This can be an input or an output device.

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 *

from time import *

 

d1=digital("BB 1")

d1.on()

sleep(5)

d1.off()

 

CE products:

from digital import *

from time import *

 

d1=digital("BB 1")

d1.on()

sleep(5)

d1.off()

Range:

Describe:

Reads the state of the digital input and returns a value of 1 or 0 to the caller.

Result:

 

Type or
Addressable
Component:

Control

 

var.set(value)

Command:

var.set(value)

Command
Syntax:

var.set(value)

Range:

Describe:

Sets the state of the digital output to “value” (0 or 1).

Result:

 

Type or
Addressable
Component:

Control

 

var.off()

Command:

var.off()

Command
Syntax:

var.off()

Range:

Describe:

Sets the state of the digital output to low (0).

Result:

Type or
Addressable
Component:

Control

 

var.on()

Command:

var.on()

Command
Syntax:

var.on()

Range:

Describe:

Sets the state of the digital output to high (1).

Result:

Type or
Addressable
Component:

Control