Пример #1
0
int RPI_Sensor::read_Sensor()
{
    int messwert = 0;
    switch (m_verwendeter_bus)
    {
    case I2C:
        messwert = read_I2C(); break;
    case ONEWIRE:
        messwert = read_ONEWIRE(); break;
    }
    return messwert;
}
Пример #2
0
void read_Gyro(unsigned char *data){
      /*Reads all three gyroscope values.  Returns all six bytes (high and low
     bytes for all three axes) in an array.*/
    read_I2C(data,GYRO_XOUT_L,1);
    read_I2C(data+1,GYRO_XOUT_H,1);
    read_I2C(data+2,GYRO_YOUT_L,1);
    read_I2C(data+3,GYRO_YOUT_H,1);
    read_I2C(data+4,GYRO_ZOUT_L,1);
    read_I2C(data+5,GYRO_ZOUT_H,1);
}
Пример #3
0
void read_Accel(unsigned char *data){
    /*Reads all three accelerometer values.  Returns all six bytes (high and low
     bytes for all three axes) in an array.*/
    read_I2C(data,ACCEL_XOUT_L,1);
    read_I2C(data+1,ACCEL_XOUT_H,1);
    read_I2C(data+2,ACCEL_YOUT_L,1);
    read_I2C(data+3,ACCEL_YOUT_H,1);
    read_I2C(data+4,ACCEL_ZOUT_L,1);
    read_I2C(data+5,ACCEL_ZOUT_H,1);
}
Пример #4
0
void read_MPU_test(unsigned char *data){
    read_I2C(data,WHO_AM_I,1); // use to verify identity of IMU to make sure communication is working.  Should return 0x68.
    printf("%x\n",data[0]);
}