TCS34725 How to get RGB value in MATLAB?

2 views (last 30 days)
Hi, im currently using tcs34725 which an i2c sensor. I am using this code in matlab to obtain raw data from the sensor.
if true
%
clc
clear all
a = arduino('COM3','uno','Libraries','I2C');
dev = i2cdev(a,'0x29','bus',0);
write(dev, 0, 'uint16');
data = read(dev, 5, 'uint16');
end
But the result shows data = [1137 ; 0 ; 5120 ; 3 ; 65535 ]. What is this value about? How do i extract the RGB data from the i2c sensor?
  2 Comments
Michael McGeehan
Michael McGeehan on 2 Feb 2022
Edited: DGM on 3 Feb 2022
@RAJA MUHAMAD SYUWARI BIN IBRAHIM Did you ever find an answer to this?
DGM
DGM on 3 Feb 2022
Edited: DGM on 3 Feb 2022
The TCS34725 is a 4-channel device. It has RGB channels and a fourth unfiltered light channel.
I don't have one, so I'm not going to troubleshoot anything, but I'm going to guess you'll have to select the appropriate register.
That of course, assumes that you're trying to interface directly with the sensor instead of having the microcontroller mediate the transaction. Otherwise, the problem depends entirely on whatever the microcontroller is doing or not doing, which is something that nobody else can possibly know at this point.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!