readVoltage
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
Examples
Read Voltage
Create an Arduino object and include the I2C library.
a = arduino();
Or, you can explicitly specify it in the Libraries Name-Value
pair while creating the Arduino object.
clear a; a = arduino('COM8', 'Uno', 'Libraries', 'I2C');
Create the sensor object for the sensor in use.
sensorObj = lis3dh(a);
Return one sample of voltage data.
sensorObj =
lis3dh with properties:
I2CAddress: 24 ("0x18")
Bus: 0
SCLPin: "D21"
SDAPin: "D20"
SampleRate: 100 (samples/s)
SamplesPerRead: 10
ReadMode: "latest"
SamplesRead: 0
SamplesAvailable: 0
AvailableADCPins: ["ADC1","ADC2","ADC3"]Input Arguments
Output Arguments
More About
Version History
Introduced in R2023a