Read data from digital pin on Arduino hardware
Create a connection to Arduino hardware and read digital pin 13.
a = arduino; readDigitalPin(a,'D13')
ans = 1
a— Arduino hardware connection
Arduino hardware connection
arduino, specified as an object.
pin— Digital pin number
Digital pin number on the physical hardware, specified as a character vector.
value— value acquired from digital pin
Value acquired from digital pin, returned as a numeric double.
readDigitalPin in a MATLAB® Function block with the Simulink® Support Package for Arduino Hardware to generate code that can be deployed on Arduino Hardware.
Configure the Arduino peripherals to the appropriate mode using
configurePin before using
readDigitalPin in the MATLAB Function