Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c0d3st0rm/microperi
MicroPeri is a library for using the BBC micro:bit with MicroPython as an external peripheral device or sensor, using an API which closely replicates the micro:bit's MicroPython API (under the process of being improved & refactored).
https://github.com/c0d3st0rm/microperi
Last synced: about 1 month ago
JSON representation
MicroPeri is a library for using the BBC micro:bit with MicroPython as an external peripheral device or sensor, using an API which closely replicates the micro:bit's MicroPython API (under the process of being improved & refactored).
- Host: GitHub
- URL: https://github.com/c0d3st0rm/microperi
- Owner: c0d3st0rm
- License: mit
- Created: 2016-05-09T15:06:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-06T18:25:28.000Z (almost 5 years ago)
- Last Synced: 2024-09-01T08:01:47.179Z (5 months ago)
- Language: Python
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
- awesome-microbit-zh - MicroPeri - 使用micro:bit MicroPython API在电脑上运行Python程序以及作为外围设备或传感器连接micro:bit. (编程 / Python)
README
NOTE: This is the dev branch.
============================================================
MicroPeri for the BBC micro:bit
===============================
MicroPeri is a quick and easy to use Python 3 library for turning the BBC Microbit into an external peripheral device or sensor for a normal Windows, Mac or Linux computer using MicroPython.With it, you can quickly for example read accelerator values, button presses or even write to the LED matrix using the same API as is used with MicroPython.
Installation
============
1. You must first make sure you have a blank MicroPython .hex file loaded onto your Microbit. You can create one `here `_.
2. If using Windows, you must have the ARM mbed USB serial driver installed. It can be downloaded from the `mbed site `_.
3. Either install the library with (soon):# pip3 install microperi
Or just use it as a portable module with *zero* install. As long as the `microperi` directory is in the same one as your scripts which use it, you can use `import microperi` just as normal.
You also no longer need the Python 3 pyserial (serial) module installed on your system, as it comes bundled along with microperi (see `microperi/_portable_serial/LICENSE.txt `_ for the pyserial copyright notice).
Notes:
======
- Some functions and parts of the current micro:bit MicroPython API are not yet implemented - see the `issues page `_ for more information.
- If on Linux, you will need superuser priviledges to open the serial port, or your user needs to be in the `dialout` group.Usage
=====
(outdated)
.. code-block:: pythonimport microperi
# try to find the micro:bit automatically
device = microperi.Microbit()
microbit = device.microbit
microbit.display.scroll("Hello world")
while True:
# is button A currently being pressed?
if microbit.button_a.is_pressed():
print("Button A is pressed")
else:
print("Button A is not pressed")
microbit.sleep(500)