Skip to content

Commit

Permalink
Merge pull request #82 from deshipu/microbit-docs
Browse files Browse the repository at this point in the history
Add documentation for the base microbit module
  • Loading branch information
ntoll committed Nov 8, 2015
2 parents cc43018 + 4c3357c commit 56a388c
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Contents:

api_design_heuristics.rst
microbit_micropython_api.rst
microbit.rst
music_api.rst
compass.rst

Expand Down
78 changes: 78 additions & 0 deletions docs/microbit.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Microbit Module
***************

.. py::module:: microbit
The ``microbit`` module gives you access to all the hardware that is built-in
into your board.


Functions
=========

.. py:function:: panic()
Enter a panic mode. Requires restart.


.. py:function:: reset()
Restart the board.


.. py:function:: sleep(n)
Wait for ``n`` milliseconds. One second is 1000 milliseconds, so::

microbit.sleep(1000)

will pause the execution for one second.


.. py:function:: random(n)
Generate a pseudo-random number between 0 and ``n``-1. For instance::

result = microbit.random(6) + 1

will simulate a roll of a six-sided die, giving numbers from 1 to 6
inclusive.


.. py:function:: running_time()
Return the number of milliseconds since the board was switched on or
restarted.


Attributes
==========

.. toctree::
:maxdepth: 1
button.rst
pin.rst


Classes
=======

.. toctree::
:maxdepth: 1

image.rst


Modules
=======

.. toctree::
:maxdepth: 1

display.rst
music_api.rst
uart.rst
i2c.rst
accelerometer.rst
compass.rst

3 comments on commit 56a388c

@dpgeorge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntoll when you merge, could you please rebase first? This keeps the git history nice and clean. To do that you do:

$ git checkout <branch to merge>
$ git rebase master
$ git checkout master
$ git merge <branch to merge>

Things can go wrong doing the rebase, and it can require a bit of skill to fix them sometimes, but usually it's pretty smooth. You can read more here: https://github.com/micropython/micropython/wiki/DevelWorkflow

@ntoll
Copy link
Contributor Author

@ntoll ntoll commented on 56a388c Nov 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpgeorge oops... so sorry about this. Will remember in future.

@dpgeorge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntoll thanks!

Please sign in to comment.