-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from deshipu/microbit-docs
Add documentation for the base microbit module
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
56a388c
There was a problem hiding this comment.
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:
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
56a388c
There was a problem hiding this comment.
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.
56a388c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntoll thanks!