How do i read multiple bytes with one command on arduino?

조회 수: 2 (최근 30일)
Philip Lorenz
Philip Lorenz 2018년 8월 20일
댓글: Eric Prandovsky 2022년 9월 7일
I have a CCS811 sensor and the bytes i need are in the same register (0x02), the datasheet says it can be up to 8bytes. there are no commands to read more than 2 bytes in the document, so is there another way than using:
readRegister(dev,[address],[precision])?
I only use the Arduino Toolbox for matlab right now.
  댓글 수: 1
Eric Prandovsky
Eric Prandovsky 2022년 9월 7일
Were you able to get this going? I noticed there is a driver for the CCS811 in the arduino support package for 2022a.

댓글을 달려면 로그인하십시오.

채택된 답변

Helper
Helper 2018년 8월 23일
The 'read' function of i2cdev can be used. For more information please refer to the following documentation link https://www.mathworks.com/help/supportpkg/arduinoio/ref/read.html
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 12월 8일
"Doesn't answer the question"
Walter Roberson
Walter Roberson 2021년 12월 8일
@Pommel Knight:
The CCS811 sensor is connected by way of I2C bus according to https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor
The page that staff linked to is specifically about a read() method for reading from I2C bus attached to Arduino, https://www.mathworks.com/help/supportpkg/arduinoio/ref/arduinoio.i2cdev.read.html and the read() method has a required argument that is the number of bytes to read.
Thus, using read(dev, 8) should return the 8 bytes that the poster needs.
Is this not an answer to the question?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by