raspi
Connection to Raspberry Pi board
Description
This object represents a connection from the MATLAB® software to the Raspberry Pi® board. To interact with the Raspberry Pi board, use this object with the functions listed in Object Functions.
Creation
Syntax
Description
creates a
connection, mypi
= raspimypi
, from the MATLAB software to the Raspberry Pi board. Use this syntax to connect or reconnect to the same
board.
You do not need to supply the user IP address, user name, and password to
create a connection. The raspi
object reuses these
settings from the most recent successful connection to a Raspberry Pi board. These settings must be provided for the first
connection created during the setup process.
In MATLAB
Online™, the raspi
object reuses the settings from
the most recent successful connection. If connecting for the first time,
this syntax is used to create a connection to the first Raspberry Pi board listed by raspilist
with status "Ready to connect"
.
After connecting to the board, you can use mypi
to
interact with the Raspberry Pi board and peripheral devices.
To close the connection, use clear
to remove
mypi
and any other connections that use
mypi
.
overrides the IP address, user name, and password from the previous
connection. Use this syntax to connect to a board whose settings are
different from the previous successful connection. After changing the
password on a board, use this syntax. Or, after connecting from the
MATLAB software to a second Raspberry Pi board, use this syntax. You can use this syntax without
mypi
= raspi(ipaddress
,username
,password
)username
and address
if a
successful connection has been previously created with this syntax. This
syntax is not supported in MATLAB
Online.
Note
The firmware has a default user name, 'pi'
, and
password, 'raspberry'
. The pi
user name has sudo root powers at the command line. It is a good
security practice to change the default password to a strong
password.
uses the host name instead of the IP address to make a connection to a
Raspberry Pi. Use this syntax to connect a board whose settings are
different from the previous successful connection or to connect to a second
board. You can use this syntax without mypi
= raspi(hostname
,username
,password
)username
and
address
if a successful connection has been
previously created with this syntax. This syntax is not supported in
MATLAB
Online.
creates a connection to a Raspberry Pi board in MATLAB
Online using the name assigned to the board during the setup steps
described in Connect to Raspberry Pi Hardware Board in MATLAB Online.mypi
= raspi(name
)
Note
This syntax is supported only in MATLAB Online.
creates a connection to a Raspberry Pi board in MATLAB
Online using its SerialNumber. Identify the serial number using mypi
= raspi(serialnumber
)raspilist
.
Note
This syntax is supported only in MATLAB Online.
creates a connection to a Raspberry Pi board in MATLAB
Online, and waits for up to mypi
= raspi(___,"Timeout"
,time)time
seconds for the
connection to complete. The value of time
must be
greater than the default connection timeout period of 12.5 seconds. You can
use this syntax to specify a larger timeout value if you are unable to
connect to your board.
Use this syntax with any of the input argument combinations in previous syntaxes.
Note
This syntax is supported only in MATLAB Online.
Input Arguments
Output Arguments
Properties
Object Functions
configurePin | Configure GPIO pin as digital input, digital output, or PWM output |
readDigitalPin | Read logical value from GPIO input pin |
writeDigitalPin | Write logical value to GPIO output pin |
showPins | Show diagram of GPIO pins |
writeLED | Turn LED on or off |
showLEDs | Show location, name, and color of user-controllable LEDs |
scanI2CBus | Scan I2C bus device addresses |
system | Run command in Linux shell on Raspberry Pi hardware |
openShell | Open terminal on host computer to use Linux shell on Raspberry Pi hardware |
getFile | Transfer file from Raspberry Pi hardware to host computer or MATLAB Drive |
putFile | Transfer file from host computer to target hardware |
deleteFile | Delete file on target hardware |
i2cdev | Connection to device on Raspberry Pi hardware |
spidev | Connection to SPI device on Raspberry Pi hardware |
serialdev | Connection to serial device on Raspberry Pi hardware |
cameraboard | Connection to camera board on Raspberry Pi hardware |
canChannel | Connection to CAN channel through specified device |
enableCAN | Enable CAN interface |
disableCAN | Disable CAN interface |
webcam | Create connection to Raspberry Pi web camera |