Commit Graph
46 Commits
Author SHA1 Message Date
Laurens Valk e6d2ce7f62 examples: Update use of done(). 2022-12-02 12:43:24 +01:00
Laurens Valk 3c0aaea207 usys: Add version info.
Fixes https://github.com/pybricks/pybricks-api/issues/119
2022-12-01 15:02:25 +01:00
Laurens Valk 64b0489a73 urandom: Move example to Move Hub.
Move it do a dedicated example instead of hardcoding it in the module docstring.

Also update changelog for missing previous changes while we are at it.
2022-12-01 09:55:40 +01:00
Laurens Valk ef57dbf4a1 pybricks.common.LightMatrix: Rename image() to icon().
Fixes https://github.com/pybricks/support/issues/409
2022-11-22 14:26:15 +01:00
Barry-Williamsandlaurensvalk 492d6cd2d4 pybricks.robotics.DriveBase: Add basic example. 2022-10-28 08:23:14 +02:00
Laurens Valk 1b51d71061 examples: Generate hub examples while building.
This way we don't have to commit the generated scripts.

While we do this, rename ExampleHub to ThisHub so that the common scripts can actually run.
2022-07-04 14:29:33 +02:00
David LechnerandDavid Lechner 03ee7f74e8 doc/pup/essentialhub: fix bit rot
This fixes bitrot for PR #96. Also fixes a few minor issues where
changes were missed.
2022-06-29 12:08:33 -05:00
Pavel LobodinskýandDavid Lechner 025147680c pybricks.hubs.EssentialHub: Added missing Hub 2022-06-29 12:08:33 -05:00
Laurens Valk bd7806d2d4 all: Format with black.
Also activate auto formatting. Bump flake8 and mark black
disagreements in setup.cfg.
2022-05-27 16:22:05 +02:00
Laurens Valk f934fdd9bd pybricks.common.IMU: Change example to print G force.
Since we changed the acceleration units to mm/s/s, the output values are
fairly large.

The Matrix repr function prints values up to 999, so this avoids
truncating the output.

It is also a good demo of scalar division for a Matrix / Vector.
2022-04-01 16:32:39 +02:00
Laurens Valk e69c422f83 pybricks.common.Motor: Add absolute value example.
Fixes https://github.com/pybricks/support/issues/611
2022-01-20 08:39:43 +01:00
Laurens Valk d3ae4ec9ee pybricks.pupdevices.ColorSensor: Move cleanup example.
The color sensor light is much brighter, so having an example
to turn it off is a bit more useful.

Fixes https://github.com/pybricks/pybricks-api/pull/90
2022-01-07 14:11:03 +01:00
Laurens Valk ffb2f8aa96 pybricks.pupdevices.UltrasonicSensor: Move cleanup example.
Also generalize the example so that it can be used on all hubs.
2022-01-07 13:38:07 +01:00
Pavel Lobodinskýandlaurensvalk 65c81834c9 pybricks.hubs.PrimeHub: Added a cleanup example. 2022-01-07 13:38:07 +01:00
Laurens Valk 8a6ddf677c pybricks.pupdevices.Remote: Light examples. 2021-08-05 14:56:00 +02:00
Laurens Valk 62bb262b96 pybricks.pupdevices.Remote: Add more examples. 2021-07-28 14:50:43 +02:00
Laurens Valk 72e0d87f77 ubuiltins: Examples for common exceptions. 2021-07-21 14:53:56 +02:00
Laurens Valk e8d47ffca1 uerrno: Document alongside OSError.
These are meant to be used together, so document them in the same place along with a practical example.
2021-07-19 15:03:10 +02:00
Laurens Valk 3b1fd091f1 micropython: Add examples for memory stats. 2021-07-14 16:08:52 +02:00
Laurens Valk 4c00c3209b micropython.const: Improve docstring, add example.
This merges the useful information from two different places:
- The original docstring for const.
- Writing MicroPython code for constrained devices.

Also reduce type to just int, because only ints are supported.
2021-07-14 14:48:59 +02:00
Laurens Valk a0e4ffdb5c umath: Use umath for math.
Do this for all Powered Up examples.
2021-07-14 11:22:04 +02:00
Laurens Valk 9b8a66e3da pybricks.hubs.PrimeHub: Add system examples. 2021-07-14 09:43:34 +02:00
Laurens Valk 5a8baeff4c pybricks.hubs: Add system examples. 2021-07-07 09:58:51 +02:00
Laurens Valk f8cd3451ea pupdevices.Remote: Enable it.
Also add an example.
2021-06-30 17:14:25 +02:00
Laurens Valk 3b20a811cb examples/pup/motor_dc: Add battery box example. 2021-05-21 14:00:57 +02:00
David Lechner 3dad15ac11 examples: fix use of OSError
We generally shouldn't be raising OSError from user code since it
represents an error the bubbles up from the OS. Also, when handling
an OSError, we almost always want to check for a specific error code.
2021-04-29 09:38:16 -05:00
Laurens Valk 790fcfa66a examples/pup/iodevices: Add PUPDevice example. 2021-04-29 13:03:34 +02:00
Martyn BoogaartsandGitHub 7ce3721b48 examples/pup/hub_shared: Update light animation examples.
See https://github.com/pybricks/support/issues/253

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax
2021-04-24 21:36:10 +02:00
Laurens Valk ca96ee2fce examples: Update detectable colors API. 2021-04-10 15:31:28 +02:00
Laurens Valk e91590feec examples/pup/sensor: Fix use of lights.on.
The documentation says to use a list or tuple of brightness values.

https://github.com/pybricks/support/issues/273

Implementation fixed via https://github.com/pybricks/pybricks-micropython/commit/28b5413c2b41283a5c1ea3e8cccf4a2900dd7fc3
2021-04-09 15:44:08 +02:00
Laurens Valk 7679b8b47d examples/hubs/MoveHub: imu examples 2021-02-17 23:31:19 +01:00
Jorge PereiraandLaurens Valk 109fcf19c1 examples/pup/motor: update motor_action_basic
Demo of run_angle had a typo
2021-02-14 13:54:58 +01:00
Laurens Valk 3c6ebd09bd doc/parameters/Color: add examples 2021-02-12 10:53:40 +01:00
ZPhiloandLaurens Valk 2a1640f7dc examples/pup/hubs/hub_primehub: fix button
Corrected Bluetooth button name (from BT to BLUETOOTH)
2021-01-28 09:31:41 +01:00
Laurens Valk 55d7a8a254 examples/pup: acceleration and angular velocity 2021-01-20 16:02:36 +01:00
Laurens Valk e051455e23 examples/pup: add imu tilt examples 2021-01-20 14:55:27 +01:00
Laurens Valk 4b5b97bbb2 examples/pup: add imu up() example 2021-01-20 11:13:24 +01:00
Laurens Valk 1573508f75 examples/pup/primehub: auto rotate display 2021-01-20 11:05:09 +01:00
Laurens Valk 018b0d8b9d examples: simplify hub script generator
Instead of saying that some lines should be skipped, just say for which hubs the entire script will work.
2021-01-20 10:56:21 +01:00
Laurens Valk 47d7fa46d8 examples: drop common inventorhub scripts
The doc page has been merged into one page, with all examples using the PrimeHub class.
2021-01-20 10:40:26 +01:00
Laurens Valk 92311b65fb examples/pup/hub_primehub: no need to call off()
The animation is now cleared automatically when invoking the pixel method, so there's no need to call this manually anymore.

See https://github.com/pybricks/support/issues/195
2021-01-12 16:32:20 +01:00
Laurens Valk 1c201b5f8c examples/pup: generate light matrix examples 2020-11-11 18:56:38 +01:00
Laurens Valk abe1be18b2 examples/pup: add common light matrix display 2020-11-11 17:09:44 +01:00
Laurens Valk b0ffb24a2e examples: import snippets from pybricks-projects
These code samples are rendered in the docs, so we include them here.

For the git history of these snippets, see:
https://github.com/pybricks/pybricks-projects/commits/f4914069aaacfd9ab1e0dd6f05524f62cfc56b29/snippets
2020-11-04 10:17:33 +01:00
Laurens Valk 7ca33d8b97 projects: add submodule
This will contain the code snippets included by the docs.
2019-12-09 16:47:40 +01:00
Laurens Valk b8458cd086 add example submodule 2019-05-09 14:27:04 +02:00