Salida digital#

Introducción#

The digital_out class allows the EXP Brain to send a digital signal to an external component such as an LED, relay, or other electronic device. It can send a high signal (5 volts) or a low signal (0 volts).

Constructores de clases#

digital_out(
  triport::port &port );

Instructor de clase#

Destroys the digital_out object and releases associated resources.

~digital_out();

Parámetros#

Parámetro

Tipo

Descripción

port

triport::port &

The 3-Wire Port that the Digital Output device is connected to, written as Brain.ThreeWirePort.X or ExpanderName.X, where X is the port letter (for example, Brain.ThreeWirePort.A or Expander1.A).

Ejemplo#

// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);

Funciones de los miembros#

The digital_out class includes the following member functions:

  • set — Sets the signal level of a 3-Wire Digital Out port to high or low.

Before calling any digital_out member functions, a digital_out instance must be created, as shown below:

/* This constructor is required when using VS Code.
Digital output configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */

// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);

set#

Establece el nivel de señal del puerto de 3 hilos seleccionado.

Available Functions
void set(
  bool value );

Parameters

Parámetro

Tipo

Descripción

value

bool

Whether to send a high or low signal: true sends a high signal (5V), and false sends a low signal (0V).

Return Values

Esta función no devuelve ningún valor.

Examples
// Set the Digital Output to true
DigitalOutA.set(true);

// Set the Digital Output to false
DigitalOutA.set(false);