writeDigitalPin
Description
writeDigitalPin(
writes the logic level value controller
,pin
,value
)value
to the digital output pin
pin
on the Aardvark™ or
NI™ USB-845x controller
controller
.
Examples
Write Logic Level Value to Digital Pin on NI USB-845x Controller
Connect to an NI USB-845x Interface Device and send a logic level value to one of its digital I/O pins.
Connect to the NI USB-845x using its serial number. In this example, the NI USB-845x controller board that is connected to the computer has the serial
number 01F26E0A
.
controller = ni845x("01F26E0A");
View the available digital I/O (DIO) pins on the controller and their respective pin
modes by using the DigitalPinModes
property.
controller.DigitalPinModes
ans = 8×2 table Pin Mode ______ _______ "P0.0" "input" "P0.1" "input" "P0.2" "input" "P0.3" "input" "P0.4" "input" "P0.5" "input" "P0.6" "input" "P0.7" "input"
These pins are connected to pins on the I2C peripheral device. You can send logic level values to output pins. Configure the DIO(0) pin, P0.0, as output.
configureDigitalPin(controller,"P0.0","output")
Send a logic high level to the pin that you just configured as output.
writeDigitalPin(controller,"P0.0",1)
Input Arguments
controller
— Controller connection
aardvark
object | ni845x
object
Controller connection, specified as an aardvark
object or
ni845x
object.
Example: writeDigitalPin(controller,pin,value)
writes the logic
level to a pin on the Aardvark or NI USB-845x controller controller
.
pin
— Digital output pin number
character vector | string scalar
Digital output pin number to write logic level value to, specified as a character
vector or string scalar. Possible values are the pin numbers returned by
controller.AvailableDigitalPins
.
If a digital pin is not already configured as an output pin, you can set it using
the configureDigitalPin
function.
Example: writeDigitalPin(controller,"Pin1",value)
writes the logic
level to pin "Pin1"
.
Data Types: char
| string
value
— Logic level value
true
or 1
| false
or 0
Logic level value to write to the digital pin, specified as a numeric or logical 1
(true
) or 0 (false
).
Example: writeDigitalPin(controller,pin,0)
writes the logic level
as 0.
Data Types: double
| logical
Version History
Introduced in R2023a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)