Use DS3502 digital potentiometer with Arduino support package

3 views (last 30 days)
I am trying to use a Adafruit DS3502 I2C Digital Potentiometer with the Matlab Arduino support package. I already connected the arduino to the computer and the digital pot to the arduino. I have loaded the arduino and the digital pot device via
ard = arduino;
COM = string(ard.Port);
Board = string(ard.Board);
clear ard
a = arduino(COM,Board,'Libraries','I2C');%load Arduino board
addrs = scanI2CBus(a);
%
ds3502 = device(a,'I2CAddress',0x28);
My question is how do I write to the device? The digital pot has a 127 different resistance values.

Answers (1)

Supraja
Supraja on 2 Jun 2023
You can use the writeDigitalPin function to write into the device of the Arduino. The syntax of the function is: writeDigitalPin(a,pin,value)
This writes the specified value to the specified pin on the Arduino hardware in the connection a
You can follow the link here for further reference:https://www.mathworks.com/help/supportpkg/arduinoio/ref/writedigitalpin.html

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!