Hello,
I try to retrieve the values of the l3G4200d gyroscope by spinnaker but I do not receive anything on the MISO line.
I simply actively have the sensor enabled by enabling the CTRL_REG1 register and enabled all available axis values.
You can look at my code for me, what could be the problem please, I will attach the datasheets that I use for the sensor
#include <SPI.h>
#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define CTRL_REG3 0x22
#define CTRL_REG4 0x23
#define CTRL_REG5 0x24
// Declaration des variables
const int chipSelectPin = 10;
void setup() {
Serial.begin(9600);
Serial.println("Start SPI");
// start the SPI library:
SPI.begin();
// initalize the data ready and chip select pins:
pinMode(chipSelectPin, OUTPUT);
writeRegister(0x20,0x0F);
}
void loop() {
// put your main code here, to run repeatedly:
int tempData = readRegister();
Serial.println("Données recu:");
Serial.println(tempData);
}
int readRegister(){
digitalWrite(chipSelectPin, LOW);
SPI.transfer(0x28);
unsigned char highByteA = SPI.transfer(0x00); // Read High Byte of RESA
SPI.transfer(0x29);
unsigned char lowByteA = SPI.transfer(0x00);
unsigned charresult = highByteA;
digitalWrite(chipSelectPin, HIGH);
strcat(result ,lowByteA )
// return the result:
return (result);
}
void writeRegister(byte thisRegister, byte thisValue) {
// take the chip select low to select the device:
digitalWrite(chipSelectPin, LOW);
SPI.transfer(thisRegister); //Send register location
SPI.transfer(thisValue);
// take the chip select high to de-select:
digitalWrite(chipSelectPin, HIGH);
}
datasheets :