configurePin
Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.
Description
Examples
Configure Pin as Input and Read Its Value
Configure a GPIO
pin as digital input and read its logical value.
Create a connection from MATLAB® to the NVIDIA® Jetson board.
hwobj = jetson
hwobj = jetson with properties: DeviceAddress: 'jetson-board-name' Port: 22 BoardName: 'NVIDIA Jetson TX2' CUDAVersion: '10.0' cuDNNVersion: '7.6' TensorRTVersion: '6.0' SDLVersion: '1.2' V4L2Version: '1.14.2-1' GStreamerVersion: '1.14.5' OpenCVVersion: '4.1.1' GPUInfo: [1x1 struct] WebcamList: [] AvailableDigitalPins: [7 11 12 13 15 16 18 19 21 22 23 24 29 31 32 33 35 36 37 38 40]
The AvailableDigitalPins
property shows the list of available digital GPIO
pins.
Show the location of the GPIO
pins on your device.
showPins(hwobj)
Display the AvailableDigitalPins
.
hwobj.AvailableDigitalPins
ans = 7 11 12 13 15 16 18 19 21 22 23 24 29 31 32 33 35 36 37 38 40
Connect your digital device to the first GPIO
pin available, for example GPIO 7
.
Configure pin GPIO 7
as a digital input.
configurePin(hwobj,7,'DigitalInput')
Read the value from pin GPIO 4
.
readDigitalPin(hwobj,7)
ans = 1
The logical value of 1
indicates a positive voltage signal on the pin GPIO 7
.
Configure Pin as Output and Write Its Value
Configure a GPIO
pin as a digital output and write its logical value.
Create a connection from the MATLAB software to the NVIDIA Jetson board.
hwobj = jetson
hwobj = jetson with properties: DeviceAddress: 'jetson-board-name' Port: 22 BoardName: 'NVIDIA Jetson TX2' CUDAVersion: '10.0' cuDNNVersion: '7.6' TensorRTVersion: '6.0' SDLVersion: '1.2' V4L2Version: '1.14.2-1' GStreamerVersion: '1.14.5' OpenCVVersion: '4.1.1' GPUInfo: [1x1 struct] WebcamList: [] AvailableDigitalPins: [7 11 12 13 15 16 18 19 21 22 23 24 29 31 32 33 35 36 37 38 40]
The AvailableDigitalPins
property shows the list of available digital GPIO
pins.
Show the location of the GPIO
pins on your device.
showPins(hwobj)
Display the AvailableDigitalPins
.
hwobj.AvailableDigitalPins
ans = 7 11 12 13 15 16 18 19 21 22 23 24 29 31 32 33 35 36 37 38 40
Connect your digital device to an available GPIO
pin, for example GPIO 11
.
Configure pin GPIO 11
as a digital output.
configurePin(hwobj,11,'DigitalOutput')
Write a logical value of 1
to pin GPIO 11
.
writeDigitalPin(hwobj,11,1)
The logical value of 1
sets the signal voltage on pin GPIO 11
to high.
Input Arguments
hwobj
— Connection to a specific NVIDIA hardware board
jetson object
Connection to a specific NVIDIA hardware board, specified as a jetson
object.
pinNumber
— GPIO pin number
scalar
GPIO pin number, specified as a scalar. This argument does not accept vectors because the hardware cannot access multiple pins simultaneously.
To get a list of valid pin numbers, use the AvailableDigitalPins
property of the jetson
object. For example,
.hwobj
.AvailableDigitalPins
Example: 12
Data Types: double
mode
— Mode used to configure the pin
'DigitalInput'
| 'DigitalOutput'
| 'Unset'
Mode used to configure the pin, specified as 'DigitalInput'
,
'DigitalOutput'
, or 'Unset'
.
Data Types: char
| string
Output Arguments
pinMode
— Current configuration mode of pin
'DigitalInput'
| 'DigitalOutput'
| 'Unset'
Current configuration mode of pin, returned as 'DigitalInput'
,
'DigitalOutput'
, or 'Unset'
.
Version History
Introduced in R2021b
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)