Question
I use the LIS3MDL Sensor: When I power the sensor and request via SPI the WHOAMI Register, the first answer is not equal to the default answer. When I send another byte to read the Register afterwards I get the default answer. Why is that so?
data[0]=0B10001111;
data[1]=0B00000000;
data[3]=0B00000000; //this is not needed but i get the default answer here
SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
delay(10);
for (size_t i = 0; i < datalen; i++)
{
data[i] = SPI.transfer(data[i]);
}
digitalWrite(10, HIGH);
SPI.endTransaction();
