1515--------------------
1616
1717**Hardware:**
18- * Adafruit's MPU6050 Breakout: https://adafruit.com/products/3886
18+
19+ * Adafruit `MPU-6050 6-DoF Accel and Gyro Sensor
20+ <https://www.adafruit.com/product/3886>`_
1921
2022**Software and Dependencies:**
2123
2224* Adafruit CircuitPython firmware for the supported boards:
23- https://github.com/adafruit/circuitpython/releases
24-
25- * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
26- * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
25+ https://circuitpython.org/downloads
26+ * Adafruit's Bus Device library:
27+ https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+ * Adafruit's Register library:
29+ https://github.com/adafruit/Adafruit_CircuitPython_Register
2730"""
2831
2932# imports
6568class Range : # pylint: disable=too-few-public-methods
6669 """Allowed values for `accelerometer_range`.
6770
68- - `` Range.RANGE_2_G` `
69- - `` Range.RANGE_4_G` `
70- - `` Range.RANGE_8_G` `
71- - `` Range.RANGE_16_G` `
71+ - :attr:` Range.RANGE_2_G`
72+ - :attr:` Range.RANGE_4_G`
73+ - :attr:` Range.RANGE_8_G`
74+ - :attr:` Range.RANGE_16_G`
7275
7376 """
7477
@@ -81,10 +84,10 @@ class Range: # pylint: disable=too-few-public-methods
8184class GyroRange : # pylint: disable=too-few-public-methods
8285 """Allowed values for `gyro_range`.
8386
84- - `` GyroRange.RANGE_250_DPS` `
85- - `` GyroRange.RANGE_500_DPS` `
86- - `` GyroRange.RANGE_1000_DPS` `
87- - `` GyroRange.RANGE_2000_DPS` `
87+ - :attr:` GyroRange.RANGE_250_DPS`
88+ - :attr:` GyroRange.RANGE_500_DPS`
89+ - :attr:` GyroRange.RANGE_1000_DPS`
90+ - :attr:` GyroRange.RANGE_2000_DPS`
8891
8992 """
9093
@@ -97,13 +100,13 @@ class GyroRange: # pylint: disable=too-few-public-methods
97100class Bandwidth : # pylint: disable=too-few-public-methods
98101 """Allowed values for `filter_bandwidth`.
99102
100- - `` Bandwidth.BAND_260_HZ` `
101- - `` Bandwidth.BAND_184_HZ` `
102- - `` Bandwidth.BAND_94_HZ` `
103- - `` Bandwidth.BAND_44_HZ` `
104- - `` Bandwidth.BAND_21_HZ` `
105- - `` Bandwidth.BAND_10_HZ` `
106- - `` Bandwidth.BAND_5_HZ` `
103+ - :attr:` Bandwidth.BAND_260_HZ`
104+ - :attr:` Bandwidth.BAND_184_HZ`
105+ - :attr:` Bandwidth.BAND_94_HZ`
106+ - :attr:` Bandwidth.BAND_44_HZ`
107+ - :attr:` Bandwidth.BAND_21_HZ`
108+ - :attr:` Bandwidth.BAND_10_HZ`
109+ - :attr:` Bandwidth.BAND_5_HZ`
107110
108111 """
109112
@@ -119,10 +122,10 @@ class Bandwidth: # pylint: disable=too-few-public-methods
119122class Rate : # pylint: disable=too-few-public-methods
120123 """Allowed values for `cycle_rate`.
121124
122- - `` Rate.CYCLE_1_25_HZ` `
123- - `` Rate.CYCLE_5_HZ` `
124- - `` Rate.CYCLE_20_HZ` `
125- - `` Rate.CYCLE_40_HZ` `
125+ - :attr:` Rate.CYCLE_1_25_HZ`
126+ - :attr:` Rate.CYCLE_5_HZ`
127+ - :attr:` Rate.CYCLE_20_HZ`
128+ - :attr:` Rate.CYCLE_40_HZ`
126129
127130 """
128131
@@ -135,8 +138,34 @@ class Rate: # pylint: disable=too-few-public-methods
135138class MPU6050 :
136139 """Driver for the MPU6050 6-DoF accelerometer and gyroscope.
137140
138- :param ~busio.I2C i2c_bus: The I2C bus the MPU6050 is connected to.
139- :param address: The I2C slave address of the sensor
141+ :param ~busio.I2C i2c_bus: The I2C bus the device is connected to
142+ :param int address: The I2C device address. Defaults to :const:`0x68`
143+
144+ **Quickstart: Importing and using the device**
145+
146+ Here is an example of using the :class:`MPU6050` class.
147+ First you will need to import the libraries to use the sensor
148+
149+ .. code-block:: python
150+
151+ import board
152+ import adafruit_mpu6050
153+
154+ Once this is done you can define your `board.I2C` object and define your sensor object
155+
156+ .. code-block:: python
157+
158+ i2c = board.I2C() # uses board.SCL and board.SDA
159+ mpu = adafruit_mpu6050.MPU6050(i2c)
160+
161+ Now you have access to the :attr:`acceleration`, :attr:`gyro`
162+ and :attr:`temperature` attributes
163+
164+ .. code-block:: python
165+
166+ acc_x, acc_y, acc_z = sensor.acceleration
167+ gyro_x, gyro_y, gyro_z = sensor.gyro
168+ temperature = sensor.temperature
140169
141170 """
142171
@@ -194,14 +223,14 @@ def reset(self):
194223
195224 @property
196225 def temperature (self ):
197- """The current temperature in º C """
226+ """The current temperature in º Celsius """
198227 raw_temperature = self ._raw_temp_data
199228 temp = (raw_temperature / 340.0 ) + 36.53
200229 return temp
201230
202231 @property
203232 def acceleration (self ):
204- """Acceleration X, Y, and Z axis data in m/s^2"""
233+ """Acceleration X, Y, and Z axis data in :math:` m/s^2` """
205234 raw_data = self ._raw_accel_data
206235 raw_x = raw_data [0 ][0 ]
207236 raw_y = raw_data [1 ][0 ]
@@ -227,7 +256,7 @@ def acceleration(self):
227256
228257 @property
229258 def gyro (self ):
230- """Gyroscope X, Y, and Z axis data in º/s"""
259+ """Gyroscope X, Y, and Z axis data in :math:` º/s` """
231260 raw_data = self ._raw_gyro_data
232261 raw_x = raw_data [0 ][0 ]
233262 raw_y = raw_data [1 ][0 ]
@@ -253,7 +282,7 @@ def gyro(self):
253282
254283 @property
255284 def cycle (self ):
256- """Enable or disable perodic measurement at a rate set by `cycle_rate`.
285+ """Enable or disable periodic measurement at a rate set by :meth: `cycle_rate`.
257286 If the sensor was in sleep mode, it will be waken up to cycle"""
258287 return self ._cycle
259288
0 commit comments