(多分)全部+フライトピン+新しい加速度
Dependencies: mbed
Diff: MPU6050.h
- Revision:
- 18:2a47ed430cfe
- Parent:
- 8:d41f5d7d2aa5
--- a/MPU6050.h Tue Nov 20 06:43:02 2018 +0000 +++ b/MPU6050.h Fri Nov 23 09:31:07 2018 +0000 @@ -119,12 +119,12 @@ } - void readAccelData(float * destination) {//intからfloatに書き換えました。 + void readAccelData(int * destination) { /** 加速度の読み出し * @param destination int[3]の配列を渡してください、加速度をxyz順に返します */ uint8_t rawData[6]; // x/y/z accel register data stored here - readBytes(ACCEL_XOUT_H, 6, &rawData[0]); // Read the six raw data registers into data array + readBytes(ACCEL_XOUT_H, 6, &rawData[0]); //(格納されているアドレス,データの長さ,格納するアドレス) Read the six raw data registers into data array destination[0] = (int)(((int8_t)rawData[0] << 8) | rawData[1]) ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = (int)(((int8_t)rawData[2] << 8) | rawData[3]) ; destination[2] = (int)(((int8_t)rawData[4] << 8) | rawData[5]) ;