Dependencies: ConfigFile SDFileSystem mbed
Fork of LAURUS_program by
Diff: MPU6050/MPU6050.cpp
- Revision:
- 38:ada39f1c6c76
- Parent:
- 1:6cd6d2760856
--- a/MPU6050/MPU6050.cpp Wed Dec 16 13:02:55 2015 +0000 +++ b/MPU6050/MPU6050.cpp Sat Dec 19 13:50:53 2015 +0000 @@ -23,17 +23,18 @@ cmd[1] = data | 0x08; ret = i2c->write(mpu_addr, cmd, 2); if(ret != 0) return 0; + //12月19日18:45時点:上のどっかで0が返されてしまっているらしい return 1; } int MPU6050::read() { char cmd[1] = {0x3b}; + int val; int ret = i2c->write(mpu_addr, cmd, 1, true); if(ret != 0) return 0; - - i2c->read(mpu_addr | 0x01, (char*)data.reg, 14, false); - + val = i2c->read(mpu_addr | 0x01, (char*)data.reg, 14, false); + checker_set(val); // データのHとLが逆に読み込まれているのでスワップする for(int i=0; i<7; i++) { uint8_t temp = 0;