Salida digital#

Inicializando la clase DigitalOut#

Una salida digital se crea utilizando el siguiente constructor:

DigitalOut(port)

Este constructor utiliza un parámetro:

Parámetro

Descripción

port

The 3-Wire Port that the Digital Output is connected to, whether it’s a port on the Brain, or a 3-Wire Expander.

A Brain or 3-Wire Expander must be created first before they can be used to create an object with the DigitalOut Class constructor.

# Create the Brain.
brain = Brain()
# Construct a Digital Output "digout" with the
# DigitalOut class.
digout = DigitalOut(brain.three_wire_port.a)

This digout object will be used in all subsequent examples throughout this API documentation when referring to DigitalOut class methods.

Métodos de clase#

set()#

The set(value) method sets the value of the Digital Output.

Parámetros

Descripción

value

The value to set for the Digital Output, 1, True, 0, or False.

Devoluciones: Ninguna.

# Set Digital Output to True.
digout.set(True)