Aschur Digiteach#

Réamhrá#

Ligeann an rang digital_out don EXP Brain comhartha digiteach a sheoladh chuig comhpháirt sheachtrach amhail soilse LED, athsheachadán, nó gléas leictreonach eile. Is féidir leis comhartha ard (5 volta) nó comhartha íseal (0 volta) a sheoladh.

Tógálaithe Ranga#

digital_out(
  triport::port &port );

Scriostóir Ranga#

Scriosann sé an réad digital_out agus scaoileann sé acmhainní gaolmhara.

~digital_out();

Paraiméadair#

Paraiméadar

Cineál

Cur síos

port

triport::port &

An Port 3-Sreang a bhfuil an gléas Aschuir Dhigitigh ceangailte leis, scríofa mar Brain.ThreeWirePort.X nó ExpanderName.X, áit a seasann X do litir an phoirt (mar shampla, Brain.ThreeWirePort.A nó Expander1.A).

Sampla#

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

Feidhmeanna na mBall#

Áirítear leis an rang digital_out na feidhmeanna ball seo a leanas:

  • set — Socraíonn sé leibhéal comhartha calafoirt Aschuir Dhigitigh 3-Sreang go hard nó íseal.

Sula nglaotar ar aon fheidhm digital_out ball, ní mór sampla digital_out a chruthú, mar a thaispeántar thíos:

/* 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#

Socraíonn sé leibhéal comhartha an Phoirt 3-Sreang roghnaithe.

Available Functions
void set(
  bool value );

Parameters

Paraiméadar

Cineál

Cur síos

value

bool

Cibé acu comhartha ard nó íseal atá le seoladh: true seolann comhartha ard (5V), agus false seolann comhartha íseal (0V).

Return Values

Ní thugann an fheidhm seo luach ar ais.

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

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