Read and Write Data
Read and write directly to Arduino®
hardware
Create an Arduino object using arduino
before you use read and write functions. See Connect to Arduino Hardware for more information. You can also use Arduino Explorer
app to configure each pin of the Arduino to read and write data.
Note
All functions, except playTone
, can be used to
generate code using the MATLAB Function block. For more details, see Deploy Arduino Functions to Arduino Hardware Using MATLAB Function Block.
Functions
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 |