microbit | Using micro : bit with the LEGO MINDSTORMS EV3

 by   JorgePe Python Version: Current License: MIT

kandi X-RAY | microbit Summary

kandi X-RAY | microbit Summary

microbit is a Python library typically used in Internet of Things (IoT), Raspberry Pi, Arduino applications. microbit has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. However microbit build file is not available. You can download it from GitHub.

Using micro:bit with the LEGO MINDSTORMS EV3. The BBC micro:bit is a small ARM-based embedded system designed for Education. It has a few sensors, LEDs, buttons and GPIO pins and can be used through USB or Bluetooh Low Energy. This is a quick demonstration of how we can use a LEGO MINDSTORMS EV3 to communicate with a micro:bit through BLE. Will just how to present something in the the LED Matrix and read the two buttons but is very easy to use all the onboard devices.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              microbit has a low active ecosystem.
              It has 7 star(s) with 2 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              microbit has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of microbit is current.

            kandi-Quality Quality

              microbit has 0 bugs and 1 code smells.

            kandi-Security Security

              microbit has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              microbit code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              microbit is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              microbit releases are not available. You will need to build from source code and install.
              microbit has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              It has 98 lines of code, 1 functions and 3 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed microbit and discovered the below as its top functions. This is intended to give you an instant insight into microbit implemented functionality, and help decide if they suit your requirements.
            • Handle data received .
            Get all kandi verified functions for this library.

            microbit Key Features

            No Key Features are available at this moment for microbit.

            microbit Examples and Code Snippets

            No Code Snippets are available at this moment for microbit.

            Community Discussions

            QUESTION

            How to use external modules in MicroPython on micro:bit from VSCode
            Asked 2022-Jan-11 at 07:43

            I’m new to both micro:bit and MicroPython (or Python in general) - but I want to have it all running in VSCode. I grabbed this extension which was really smooth working with.

            My problem now is that I want to leverage external modules, for things like the NeoPixels and also the bit:bot stuff, but I don’t know how to actually get that working. The NeoPixel tutorial is straight forward, but there is no mention on how to add the module.

            I tried adding them with pip - but that won’t make them end up on the device. I’ve also tried this extension - hoping it would do some more magic in getting it onto the device.

            Is this doable? Or would I have to revert do the online editors?

            ...

            ANSWER

            Answered 2022-Jan-11 at 07:43

            The micro:bit is a very constrained environment and will not run Python only MicroPYthon. MicroPython was designed to work under the constrained conditions of a microcontroller. As a result MicroPython does not come with the full Python standard library and only includes a small subset of the Python standard library.

            For MicroPython to run on the micro:bit there needs to be the MicroPython hex file and any Python code that you have written, with main.py being the entry point.

            The VS Code Extensions you linked to use uFlash to copy from your machine to the micro:bit the hex file and any Python files you have written.

            To use the neopixel module it should be as straight forward as import neopixel as it is part of the standard BBC micro:bit MicroPython.

            For BitBot, it only uses the standard micro:bit MicroPython library so I'm not sure what you are looking to import.

            You can create a module by putting the code in .py file and referencing it in your main.py file. You do this by using an import statement that calls the file or specific parts of it.

            MicroPython does have the concept of upip but I am not aware of that being available on micro:bit.

            Source https://stackoverflow.com/questions/70662020

            QUESTION

            Asyncio error "There is no current event loop in thread" when using with a flask program
            Asked 2021-Aug-04 at 14:00

            I am making a small webpage which controls a Microbit and shows some sensor data.

            I am trying to implement asynchronous read and writes to the microbit through my flask backend based on the things I click on the front end.

            But when I use flask to run a function I have it gives an error which says

            ...

            ANSWER

            Answered 2021-Aug-04 at 14:00

            The error indicates that there in no event loop in not MainThread, for async programs in Python we usually have only one asyncio loop in MainThread, we do not want more asyncio loops, since they'll be fighting each other for time and the whole app will be slower and more prone to errors.

            If I were you I would use aiohttp or any other async http framework instead of Flask, otherwise use any other not async library for serial port.

            But how you can get another loop in not MainThread if you want it? Please find example:

            Source https://stackoverflow.com/questions/68639922

            QUESTION

            How to write tests for micropython
            Asked 2021-Jul-19 at 20:31

            I would like to write tests for the micropython code I am writing for the micro:bit. The examples here use doctest. I am open to work arounds for any testing system.

            Working python example called testing_python.py:

            ...

            ANSWER

            Answered 2021-Jul-19 at 20:31

            unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used.

            This can be used to write and test embedded software like micropython without the hardware.

            You can go as sophisticated as you want, but a simple way to not get an error on importing the microbit module is to mock the microbit module. e.g. Have the following files:

            Source https://stackoverflow.com/questions/68443672

            QUESTION

            Why am I getting a TypeError: 'int' object not callable in a micro:bit MicroPython program?
            Asked 2021-Jun-05 at 09:07

            I was trying to make some kind of Boxel Rebound game for the micro:bit, and I was coding at the online web editor. It all worked fine, until I tried to implement the jumping. When I start the program, it works fine, and I get my debugging messages in the REPL:

            ...

            ANSWER

            Answered 2021-Jun-05 at 09:01

            Your Player Object has both an attribute and a method called jump (in your __init__ you have self.jump = 0). This is what your player.jump() is using (while you expect it to use the method) and you obviously cannot call an int as a method.

            Change the name of one of the two (attribute or method) and it should work.

            Source https://stackoverflow.com/questions/67847921

            QUESTION

            microbit why blinking leds is so slow?
            Asked 2021-May-09 at 13:19

            Using this basic example code from microbit, blinking heart, I tried to change the delay of blinking with the pause argument. However, the minimum actual blinking frequency is around 500ms, no matter what value i put.

            Do you know why, and how I can achieve much faster blinking with led patterns (like show_icon or show_leds function).

            ...

            ANSWER

            Answered 2021-May-08 at 16:41

            You have tagged this as micropython but I don't believe that is what you are using. I think you are running with the Python in the MakeCode editor.

            Looking at the help page for for the MakeCode show_icon, it says it is called with:

            Source https://stackoverflow.com/questions/67444902

            QUESTION

            What microcontrollers don't require a USB to UART driver to interface with computer?
            Asked 2021-Mar-22 at 09:43

            I am currently teaching a remote middle school summer camp next year that involves microcontroller programming. I’ve chosen to avoid Arduino microcontrollers for the camp and use a MicroPython compatible microcontroller instead. One microcontroller that I am interested in using is the Lolin V 1.1.0 with an ESP-Wroom-32 chip since it is cheap and reliable.

            One downside that I’ve noticed with this MCU is that a VCP driver needs to be installed in order to establish a USB to UART connection (It contains a CP210x chip). I’m not too sure how many Operating systems have a VCP driver installed by default. However, I tested to see if the microcontroller was able to be registered on three of my different laptops. On two MacBook airs, my computer was successfully able to locate the MCU without a virtual driver installed. Similarly, I used a Windows computer and a connection was able to be established after 10 minutes (Not sure why it took this long). Finally, I tried it on my friend’s European MacBook and his computer wasn’t able to locate the microcontroller until I installed the driver.

            I’m expecting that the camp would be ~300 students and I don’t want anyone to not be able to connect with their Microcontrollers and don’t want to include the installation of the driver since it can be tedious.

            Does anyone know how big companies that teach Microcontroller programming to beginners such as MicroBit, Raspberry Pi, or Arduino deal with this problem? How do they ensure that the microcontrollers are read by the computer without having to have students to go through the tedious process of installing a driver?

            What percentage of Operating systems have a CP210x VCP driver already installed?

            Are there any microcontrollers that don’t require a USB to UART driver installation altogether?

            Thanks! Ryan

            ...

            ANSWER

            Answered 2021-Mar-22 at 07:00

            The only one I am aware of that is pre-installed in windows is microchip PIC (eg PIC16F1454) but a PIC is not the best device for teaching. You have to run an application on the device to use USB VID:PID 04D8:000A.

            I don't have a machine to test it but maybe a microchip MCP2200 (04D8:00DF) will be the same.

            Source https://stackoverflow.com/questions/66739705

            QUESTION

            Is this the correct way to write a MicroPython module that works across different builds?
            Asked 2021-Mar-13 at 23:35

            I'm writing a module for an I2C temperature sensor (TMP117) with cross-compatability being a priority.

            The MicroPython implementation is different on BBC Micro:bit and Raspberry Pi Pico - an important difference is how the I2C driver is implemented:

            • Pico uses the machine class to drive i2c: i2c.writeto
            • Micro:bit has already defined i2c.write (bundled with from microbit import *) docs

            This simple difference in naming is really all that affects compatability!

            So far I have shoehorned a working solution so my module tmp117.py is usable on both platforms. In tmp117.py, when the sensor class is initialised it checks the sysname and declares function pointers self.i2cWrite and self.i2cRead that are assigned the hardware-appropriate definition.

            However, I'm quite new to Python and imagine I may have committed many atrocities in doing so by eg. mishandling namespaces or chewing up memory with inappropriate imports. Can anybody comment if this method is appropriate? In terms of scalability, needless imports, namespaces etc.

            main.py

            ...

            ANSWER

            Answered 2021-Mar-13 at 23:35

            my choice of doing the same thing would be define _PLATFORM variable, set it accordingly and use it later:

            Source https://stackoverflow.com/questions/66594433

            QUESTION

            Ada for I2C on the BBC Micro:Bit with the MCP23017
            Asked 2021-Feb-22 at 11:31

            I am trying to set up a very simple example using the ada I2C library with the MCP23017 IO expander on the micro:bit (V1.5) but I can't figure it out. For now, all I want to do is turn on an LED that is connected to a GPIOA pin. I have it working in python with the following:

            ...

            ANSWER

            Answered 2021-Feb-20 at 19:49

            I had an MCP23017 in 2012; can’t find it, so hard to help other than by suggesting lines of approach.

            Have you tied the three settable address lines in the datasheet Fig 3.6 (pins 15, 16, 17 in the diagram on the first page) to ground?

            You don’t check that the returned Status from the Master_Transmit calls is HAL.I2C.Ok.

            Looking at line 135 of nrf-twi.adb

            Source https://stackoverflow.com/questions/66282765

            QUESTION

            Ada on the microbit: scrolling text example not working, no libusb library found
            Asked 2021-Jan-28 at 23:39

            I followed the adacore tutorial on displaying scrolling text (https://blog.adacore.com/ada-for-microbit-part-1-getting-started) but can't get it working on my microbit.

            Maybe my microbit is a more recent version that is not yet supported? The reason I suspect this is that my board id (9904) was not supported the first time I tried to flash to the board. I used the fix described here: Unable to get the Ada scrolling text demo working on the microbit on GNAT 2019 community edition and added the following line in board_ids.py:

            ...

            ANSWER

            Answered 2021-Jan-23 at 14:12

            libusb is missing or not found on your computer. It is used to communicate with the Microbit board to upload/debug.

            Source https://stackoverflow.com/questions/65859253

            QUESTION

            Problems with Micropython command time_pulse_us on Microbit
            Asked 2021-Jan-12 at 13:00

            I would like to ask some help from you. I'm trying to connect a distance sensor to my microbit but when I use the command "time_pulse_us" it always gives -2 or -1. I read the documentation, I understand the meaning of those numbers but I think there's a problem with the command or probably I'm using it the wrong way.

            In that regard, I wrote a simple snippet to test the command. Could you tell me what's wrong with it?

            ...

            ANSWER

            Answered 2021-Jan-12 at 13:00

            time_pulse_us() runs sequentially, not in the background, so at the call it will wait 1 second for the pin to reach 1, which it will not do, hence time will be set to -2, before the program goes on to the next command write_digital(1).

            Source https://stackoverflow.com/questions/65677802

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install microbit

            You can download it from GitHub.
            You can use microbit like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/JorgePe/microbit.git

          • CLI

            gh repo clone JorgePe/microbit

          • sshUrl

            git@github.com:JorgePe/microbit.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link