Skip to content

Commit

Permalink
Add installation guide and other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikUmble committed May 1, 2024
1 parent 7dc2e0e commit cbabaae
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# NanoBot
Educational micropython robotics kit
Educational MicroPython robotics kit
See documentation and start guides [here](https://bram-hub.github.io/NanoNav/)
2 changes: 1 addition & 1 deletion docs/source/bluetooth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ can look at (read) whatever is on it whenever you like, and can also change (wri
above picture, you can click the :blue:`Read Again` button as often as you would like, but the value will only
change when you (or NanoNav) writes to it. And you can send a number as often as you want in LightBlue, but NanoNav will not know unless you program it to
read the value periodically. (Actually, you can setup BLE interrupts for NanoNav to run code when something changes in the BLE connection. You will not need to do this,
but if interested, see `Link here <https://docs.micropython.org/en/latest/library/bluetooth.html>`_ for advanced uses).
but if interested, see `here <https://docs.micropython.org/en/latest/library/bluetooth.html>`_ for advanced uses).
10 changes: 10 additions & 0 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FAQ
===

No questions yet.

Issues
------

Found a bug? Create an issue on GitHub. Submit `Link here <https://github.com/Bram-Hub/NanoNav/issues>`_ with as much information as you can provide
about the context of the bug.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Contents
usage
bluetooth
movement
faq

40 changes: 39 additions & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Quick Start

Installation
------------
You will need to download `Link OpenMV <https://openmv.io/pages/download>`_ to transfer your micropython code onto the arduino. See `:ref Workflow` for more information about this process.
You will need to download `OpenMV IDE <https://openmv.io/pages/download>`_ to transfer your MicroPython code onto the arduino. See :ref:`Workflow` for more information about this process.

Your Arduino Nano RP2040 can run either C++ or MicroPython, but not both at the same time. So before moving on, it is important that the Arduino is configured for MicroPython mode.
`Link this guide <https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-openmv-setup/>` from Arduino will walk you through the process of "bootloading" the Nano RP2040 so that
you can run MicroPython code on it. After you have done this once, you should not need to do it again.

To use the NanoNav supplementary code, either download :download:`nanonav.py </../../nanonav.py>` to your project directory

Or copy the code below into a file called nanonav.py
Expand All @@ -24,4 +29,37 @@ Or copy the code below into a file called nanonav.py

Workflow
--------
Here is how you can program your Arduino. You will need a file called `main.py` that contains your MicroPython code - you can create other files
and import them as usual, but `main.py` is the one that will be run on the Arduino. For getting started quickly, we recommend downloading this installation check
:download:`main.py </../../tests/installation_check/main.py>` to verify that everything is working correctly so far. Alternatively, copy the following into a file called `main.py`:

.. raw:: html

<div style="max-height: 50vh; overflow-y: scroll;">

.. literalinclude:: /../../tests/installation_check/main.py
:language: python
:linenos:

.. raw:: html

</div>

We recommend creating a folder that you will use for your MicroPython code - put both `nanonav.py` and `main.py` in that folder. Open the OpenMV IDE application. Use the File -> Open Files menu to select the `main.py` file that you downloaded.
Connect your Arduino to your computer using a USB cable. Click the "Connect" button in the bottom left of OpenMV IDE. The arrow below it should turn green when connected. Click that arrow to run
your code on the Arduino. If all worked well, you should see :red:`TODO`.

.. note::
We recommend testing your

.. _MicroPython:

MicroPython
-----------

In general, MicroPython is very similar to regular Python, but there are some difference we would like to point you to before you begin. MicroPython has its own library of
packages, which are different from the PyPi packages you may be used to (if you ever ```pip install``` anything). We provide helper functions for the ways we think you'll need to
interact with the Arduino, Bluetooth, and peripherals, and just about anything you can do in Python 3.11 can also be done in MicroPython, but note that you will not have access to the full standard Python library. For instance, you can import `time` since this has been added to
MicroPython's library, but you cannot import `Queue` or other familiar packages. If ever in doubt about whether MicroPython supports a particular package, simply google "MicroPython [package name]",
and you will likely find the information you need.
You can find the MicroPython documentation `here <https://docs.micropython.org/en/latest/>`_.
4 changes: 4 additions & 0 deletions run-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh
pip install -r requirements.txt
sphinx-build -M html docs/source docs/_build
open docs/_build/html/index.html
4 changes: 4 additions & 0 deletions tests/installation_check/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from nanonav import BLE

# TODO: Add code to use a feature or two from the nanonav module
# to ensure that MicroPython installation worked properly

0 comments on commit cbabaae

Please sign in to comment.