From b8e60e1aa2fdb83557239b7aad941ea7e5d8fcd1 Mon Sep 17 00:00:00 2001 From: "Mark A. Yoder" <Mark.A.Yoder@Rose-Hulman.edu> Date: Tue, 27 Jun 2023 16:43:45 -0400 Subject: [PATCH] =?UTF-8?q?Added=20Running=20Sparkfun=E2=80=99s=20qwiic=20?= =?UTF-8?q?Python=20Examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- books/beaglebone-cookbook/11misc/misc.rst | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/books/beaglebone-cookbook/11misc/misc.rst b/books/beaglebone-cookbook/11misc/misc.rst index e8967528..89922a25 100644 --- a/books/beaglebone-cookbook/11misc/misc.rst +++ b/books/beaglebone-cookbook/11misc/misc.rst @@ -403,3 +403,42 @@ Creating A New Book https://git.beagleboard.org/docs/docs.beagleboard.io/-/raw/main/index.rst https://git.beagleboard.org/docs/docs.beagleboard.io/-/raw/main/index-tex.rst + + +Running Sparkfun's qwiic Python Examples +======================================== + +Many of the Sparkfun qwiic devices have Python examples showing +how to use them. Unfortunately the examples assume |I2C| bus +1 is used, but the qwiic bus on the Play is bus 5. +Here is a quick hack to get the Sparkfun Python examples to use +bus 5. I'll show it for the Joystick, but it should work for the +others as well. + +Clone the Qwiic I2C repo: + +.. code-block:: bash + + bone$ git clone git@github.com:sparkfun/Qwiic_I2C_Py.git + bone$ cd Qwiic_I2C_Py/qwiic_i2c + +Edit **linux_i2c.py** and go to around line 62 and change it to: + +.. code-block:: bash + + iBus = 5 + +Next, cd up a level to the Qwiic_I2C_Py directory and install + +.. code-block:: bash + + bone$ cd .. + bone$ sudo python setup.py install + +Next, browse to Sparkfun's qwiic Joystick page, +https://www.sparkfun.com/products/15168 and click on the +**DOCUMENTS** tab and then on **Python Package**. Follow the pip +instillation instructions (sudo pip install sparkfun-qwiic-joystick) + +Finally, run one of the Joystick examples. If it isn't using +bus 5, try reinstalling setup.py again. -- GitLab