You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SparkFun Qwiic 9 Degrees of Freedom IMU 9DOF Module provides a simple and cost effective solution for adding 9 Degrees of Freedom IMU capabilities to your project. Implementing a SparkFun Qwiic I2C interface, these sensors can be rapidly added to any project with boards that are part of the SparkFun Qwiic ecosystem.
12
-
13
-
This repository implements a Python package for the SparkFun Qwiic 9DOF. This package works with Python, MicroPython and CircuitPython.
Python module for the qwiic ICM-20948 sensor, which is included on the [SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)](https://www.sparkfun.com/products/15335)
23
26
24
-
## About the Package
27
+
This python package is a port of the existing [SparkFun ICM-20948 Arduino Library](https://github.com/sparkfun/SparkFun_ICM-20948_ArduinoLibrary)
25
28
26
-
This python package enables the user to access the features of the 9DOF via a single Qwiic cable. This includes <reading acceleration, reading gyroscope, reading magnetometer, reading temperature> and more. The capabilities of the 9DOF are each demonstrated in the included examples.
29
+
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
27
30
28
31
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
29
32
30
-
### Supported SparkFun Products
33
+
##Contents
31
34
32
-
This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.
33
-
34
-
*[SparkFun 9 Degrees of Freedom IMU Sensor - 9DOF](https://www.sparkfun.com/products/15318)
35
-
36
-
### Supported Platforms
37
-
38
-
| Python | Platform | Boards |
39
-
|--|--|--|
40
-
| Python | Linux |[Raspberry Pi](https://www.sparkfun.com/raspberry-pi-5-8gb.html) , [NVIDIA Jetson Orin Nano](https://www.sparkfun.com/nvidia-jetson-orin-nano-developer-kit.html) via the [SparkFun Qwiic SHIM](https://www.sparkfun.com/sparkfun-qwiic-shim-for-raspberry-pi.html)|
> The listed supported platforms and boards are the primary platform targets tested. It is fully expected that this package will work across a wide variety of Python enabled systems.
46
-
47
-
## Installation
48
-
49
-
The first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.
50
-
51
-
### Python
52
-
53
-
#### PyPi Installation
35
+
*[Supported Platforms](#supported-platforms)
36
+
*[Dependencies](#dependencies)
37
+
*[Installation](#installation)
38
+
*[Documentation](#documentation)
39
+
*[Example Use](#example-use)
54
40
55
-
The package is primarily installed using the `pip3` command, downloading the package from the Python Index - "PyPi".
41
+
Supported Platforms
42
+
--------------------
43
+
The qwiic ICM20948 Python package current supports the following platforms:
First, setup a virtual environment from a specific directory using venv:
60
-
```sh
61
-
python3 -m venv path/to/venv
62
-
```
63
-
You can pass any path as path/to/venv, just make sure you use the same one for all future steps. For more information on venv [click here](https://docs.python.org/3/library/venv.html).
53
+
Documentation
54
+
-------------
55
+
The SparkFun qwiic ICM20948 module documentation is hosted at [ReadTheDocs](https://qwiic-9dof-imu-icm20948-py.readthedocs.io/en/latest/?)
Now you should be able to run any example or custom python scripts that have `import qwiic_icm20948` by running e.g.:
70
-
```sh
71
-
path/to/venv/bin/python3 example_script.py
72
-
```
57
+
Installation
58
+
-------------
73
59
74
-
### MicroPython Installation
75
-
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
60
+
### PyPi Installation
61
+
This repository is hosted on PyPi as the [sparkfun-qwiic-icm20948](https://pypi.org/project/sparkfun-qwiic-icm20948/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
76
62
77
-
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
63
+
For all users (note: the user must have sudo privileges):
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
73
+
### Local Installation
74
+
To install, make sure the setuptools package is installed on the system.
89
75
90
-
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
76
+
Direct installation at the command line:
91
77
```sh
92
-
circup bundle-add sparkfun/Qwiic_Py
78
+
python setup.py install
93
79
```
94
80
95
-
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
81
+
To build a package for use with pip:
96
82
```sh
97
-
circup install --py qwiic_icm20948
98
-
```
99
-
100
-
If you would like to install any of the examples from this repository, issue the corresponding circup command from below. (NOTE: The below syntax assumes you are using CircUp on Windows. Linux and Mac will have different path seperators (i.e. "/" vs. "\"). See the [CircUp "example" command documentation](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/example-command) for more information)
101
-
83
+
python setup.py sdist
84
+
```
85
+
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
Below is a quickstart program to print readings from the 9DOF.
109
-
110
-
See the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_9dof_py/blob/main/examples/README.md) for a summary of the available examples.
93
+
See the examples directory for more detailed use examples.
111
94
112
95
```python
113
-
96
+
from__future__import print_function
114
97
import qwiic_icm20948
115
98
import time
116
99
import sys
@@ -126,20 +109,20 @@ def runExample():
126
109
return
127
110
128
111
IMU.begin()
129
-
112
+
130
113
whileTrue:
131
114
ifIMU.dataReady():
132
115
IMU.getAgmt() # read all axis and temp from sensor, note this also updates all instance variables
0 commit comments