What code to use for HIh6130 spi

So I bought the wrong hih6130. I bought a spi version instead of i2c.
This is what the datasheet says

It says the first 2 bytes is for humidity and the second 2 byte is for temperature.
How do I configure it for receiving data from the sensor as most online reference I've seen use an registery address which the datasheet doesn't give
Thank you very much.

The SPI interface uses a separate Slave Select pin for each device. You set the Slave Select pin LOW to pick the device and when you are done fetching data, set the Slave Select pin back to HIGH.

You can use the SPI library with pins 10, 11, 12, and 13 (Arduino UNO) or manually set the SS pin of your choice and use the shiftIn() function for the Clock/SCLK and Data/MISO pins of your choice.

Thank you very much I seem to understand it more but it seems it can only read 2 bytes form the example code it provides MSBFIRST or LSBFIRST so I assume its 2 bytes of data. However from the data sheet it says 4 bytes of data is the value, the first 2 byte is humidity and last 2 byte is temperature.
How do I make it so I can get both the data?

MSB is most significant BIT. Each call to shiftIn() returns 8 bits. Call it four times to get four bytes.

Ah I see thank you very much

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.