数字输出#

初始化digital_out类#

使用以下构造函数创建数字输出:

The digital_out constructor creates a digital_out object in the specified Three Wire Port:

范围

描述

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 digital_out Class constructor.

// Create the Brain.
brain Brain;
// Construct a Digital Input "digin" with the
// digital_out class.
digital_out digout = digital_out(Brain.ThreeWirePort.A);

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

类方法#

set()#

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

参数

描述

value

The value to set for the digital output: true or false.

**返回:**无。

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