Read and Write Data from Arduino Pins
R2026bCreate an Arduino object using arduino before you use read and write functions. See Connect to Arduino Hardware for more information.
You can use Arduino Explorer to interactively configure pins on Arduino and other supported hardware, enabling you to read and write data in MATLAB® and MATLAB Online™. For more information, see Configure Read and Write for GPIO Pins Using Arduino Explorer App.
For a complete list of hardware supported in the installed version of MATLAB, see Supported Hardware. For more information regarding supported boards, workflows, and platforms supported on MATLAB Online, see Get Started with MATLAB Online for Arduino.
Note
All functions, except playTone, generate
code using the MATLAB Function block. For more details, see Deploy Arduino Functions to Arduino Hardware Using MATLAB Function Block.
Functions
arduino | Connection to the Arduino and Arduino-compatible ESP32 hardware |
configurePin | Set Arduino pin mode |
readDigitalPin | Read data from a specified pin on Arduino hardware |
writeDigitalPin | Write data to a specified pin on Arduino hardware |
writePWMVoltage | Generate PWM signal with specified voltage on digital pin |
writePWMDutyCycle | Generate PWM signal with specified duty cycle on digital pin |
playTone | Play tone on piezo speaker using digital pin |
readVoltage | Read voltage from analog pin on Arduino hardware |
Topics
- Use Arduino Explorer App
Learn how to use the Arduino Explorer app to configure GPIO pins and communication protocol interfaces and visualize data.
- Configure Read and Write for GPIO Pins Using Arduino Explorer App
Learn how to read and write for GPIO pins using Arduino Explorer app