I want to connect a ADXL355 development board accelerometer to an Arduino. I cant get any data form the sensor. The data_ready pin is never high and I can't read the registers.
The connections (user guide):
I connected VDD and VDDIO to 5V, ground to ground, DRDY to the correct pin, CS, SCLK, MOSI and MISO all to correct pins.
Code:
//modeled on https://www.arduino.cc/en/Tutorial/BarometricPressureSensor
#include <SPI.h>
const int ID = 0x00;
const int FIFO = 0x11;
const byte READ = 0b11111100;
const byte WRITE = 0b00000010;
const int dataReadyPin = 6;
const int chipSelectPin = 7;
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
SPI.begin();
// initalize the data ready and chip select pins:
pinMode(dataReadyPin, INPUT);
pinMode(chipSelectPin, OUTPUT);
delay(100);
readRegister(ID);
}
void loop() {
if (digitalRead(dataReadyPin) == HIGH){
Serial.println("data ready");
delay(500);
}
}
void readRegister (byte thisRegister){
byte inByte = 0 ;
Serial.println(thisRegister, BIN);
thisRegister = thisRegister<< 2;
byte dataToSend = thisRegister & READ;
Serial.println(thisRegister, BIN);
digitalWrite(chipSelectPin, LOW);
SPI.transfer(dataToSend);
inByte = SPI.transfer(0x00);
Serial.println("data: ");
Serial.println(inByte);
}