Borrar filtros
Borrar filtros

Plot values from Arduino in Matlab with multiple i2c devices

6 visualizaciones (últimos 30 días)
Alastair Reid
Alastair Reid el 14 de Mzo. de 2017
Respondida: justin el 30 de Mzo. de 2017
I have four i2c sensors attached to an Arduino, Singletact capacitive sensors, where I am making a joystick. I am using the ratio of two sensors to find a value in both the x and y axis.
I am wondering how to use Matlab to try to use the live output data to plot where the users finger is pressing. I have tried using the Matlab i2c example but I am unsure how to distinguish between different multiple i2c addresses.
I have attached the Arduino Code which I am running which produces my axis values, I am just wondering how to plot these x and y values produced.

Respuestas (1)

justin
justin el 30 de Mzo. de 2017
I have been trying to figure out how to read in SingleTact sensor data as well.
Register and download their examples files at http://www.singletact.com/software-download/
Be sure to set the addresses to something other than default in the SingleTactDemo software. First, flash the arduino with their example ino code, plug in the sensor via the I2C pin out, and run the PCExecutable.
In MATLAB, you can use the arduino ToolBox to call in the attached addresses. Then make a device with each address. Then you can use read or readRegister to call the device. This last part I am still struggling with. If you figure out pulling the sensor data, please post here. :)
a = arduino('COM3', 'Uno', 'Libraries', 'I2C');
adds=scanI2CBus(a,0)
% Prints out 00x51 for me, as I set that in the demo code.
dev=i2cdev(a,adds{1})

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by