@@ -161,7 +161,7 @@ class MPU6050:
161
161
162
162
def __init__ (self , i2c_bus , address = _MPU6050_DEFAULT_ADDRESS ):
163
163
self .i2c_device = i2c_device .I2CDevice (i2c_bus , address )
164
-
164
+
165
165
if self ._device_id != _MPU6050_DEVICE_ID :
166
166
raise RuntimeError ("Failed to find MPU6050 - check your wiring!" )
167
167
@@ -177,6 +177,7 @@ def reset(self):
177
177
# self._accel_range = MPU6050_RANGE_8_G
178
178
self ._filter_bandwidth = 0
179
179
self ._clock_source = 1
180
+ sleep (0.1 )
180
181
self .sleep = False
181
182
182
183
@@ -188,17 +189,15 @@ def reset(self):
188
189
_filter_bandwidth = RWBits (2 , _MPU6050_CONFIG , 3 )
189
190
_clock_source = RWBits (3 , _MPU6050_PWR_MGMT_1 , 0 )
190
191
sleep = RWBit (_MPU6050_PWR_MGMT_1 , 6 , 1 )
191
- # setSampleRateDivisor(0);
192
- # def __init__(self, register_address, struct_format, count):
193
192
_raw_data_array = StructArray (_MPU6050_ACCEL_OUT , ">h" , 7 )
194
193
195
194
@property
196
195
def temperature (self ):
197
196
"""docs"""
198
- rawTemp = self ._raw_data_array [3 ][0 ]
199
- temp = (rawTemp + 12412.0 ) / 340.0
197
+ raw_temperature = self ._raw_data_array [3 ][0 ]
198
+ temp = (raw_temperature + 12412.0 ) / 340.0
200
199
return temp
201
-
200
+
202
201
@property
203
202
def acceleration (self ):
204
203
raw_data = self ._raw_data_array
@@ -222,7 +221,7 @@ def acceleration(self):
222
221
accel_y = (raw_y / accel_scale ) * STANDARD_GRAVITY
223
222
accel_z = (raw_z / accel_scale ) * STANDARD_GRAVITY
224
223
225
- return (accel_x , accel_y , accel_z )
224
+ return (accel_x , accel_y , accel_z )
226
225
227
226
@property
228
227
def gyro (self ):
0 commit comments