×

SparkFun Electronics will be closed in observance of memorial day on Monday, May 29th. We will resume normal business hours on Tuesday, May 30th. Any orders placed after 2pm Mountain Time on Friday, May 26th will process and ship out on Tuesday, May 30th.

Member #474677

Member Since: October 2, 2013

Country: United States

  • from This Code.,.,. where code to change measurement Range (G)

    define GYRO 0x68 // gyro I2C address

    define REG_GYRO_X 0x1D // IMU-3000 Register address for GYRO_XOUT_H

    define ACCEL 0x53 // Accel I2c Address

    define ADXL345_POWER_CTL 0x2D

    byte buffer[12]; // Array to store ADC values int gyro_x; int gyro_y; int gyro_z; int accel_x; int accel_y; int accel_z; int i;

    include

    void setup() { Serial.begin(9600);

    Wire.begin();
    // Set Gyro settings
    // Sample Rate 1kHz, Filter Bandwidth 42Hz, Gyro Range 500 d/s 
    writeTo(GYRO, 0x16, 0x0B);       
    //set accel register data address
    writeTo(GYRO, 0x18, 0x32);     
    // set accel i2c slave address
    writeTo(GYRO, 0x14, ACCEL);     
    
    // Set passthrough mode to Accel so we can turn it on
    writeTo(GYRO, 0x3D, 0x08);     
    // set accel power control to 'measure'
    writeTo(ACCEL, ADXL345_POWER_CTL, 8);     
    //cancel pass through to accel, gyro will now read accel for us   
    writeTo(GYRO, 0x3D, 0x28);    
    

    }

    // Write a value to address register on device void writeTo(int device, byte address, byte val) { Wire.beginTransmission(device); // start transmission to device Wire.send(address); // send register address Wire.send(val); // send value to write Wire.endTransmission(); // end transmission }

    void loop() { // Read the Gyro X, Y and Z and Accel X, Y and Z all through the gyro

    // First set the register start address for X on Gyro  
    Wire.beginTransmission(GYRO);
    Wire.send(REG_GYRO_X); //Register Address GYRO_XOUT_H
    Wire.endTransmission();
    
    // New read the 12 data bytes
    Wire.beginTransmission(GYRO);
    Wire.requestFrom(GYRO,12); // Read 12 bytes
    i = 0;
    while(Wire.available())
    {
        buffer[i] = Wire.receive();
        i++;
    }
    Wire.endTransmission();
    
    //Combine bytes into integers
    // Gyro format is MSB first
    gyro_x = buffer[0] 
    
  • Do you can help me how to change Measurement Range (g) from that arduino sketch.,.,.,.,. change range from +-2G , +-4G , +-6G ,+-8G, +-16G.,.,.,. please help me.,.,.,

No public wish lists :(