Use DS3502 digital potentiometer with Arduino support package

3 vues (au cours des 30 derniers jours)
Lawrence Little
Lawrence Little le 23 Mai 2023
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.

Réponses (1)

Supraja
Supraja le 2 Juin 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

Catégories

En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange

Tags

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by