Questions tagged [micropython]

MicroPython is a Python interpreter (with partial native code compilation feature). It provides a subset of Python 3.5 features, implemented for embedded processors and constrained systems.

About

MicroPython is a lean and fast implementation of the Python 3 programming language that is optimised to run on a microcontroller. It was originally created by the Australian programmer and physicist Damien George and first appeared in May of 2014.

The MicroPython board is a small electronic circuit board that runs MicroPython on the bare metal, and gives you a low-level Python operating system that can be used to control all kinds of electronic projects.

MicroPython was successfully funded via a Kickstarter campaign. The software is available to the public under the MIT open source license.

Books

Sites

Damien George's KickStarter project to develop a API to use with ESP8266 WiFi chip, optimised and well supported. ESP8266 is one of the best boards to use with MicroPython.

Example projects

1031 questions
3
votes
1 answer

How do I record audio with MicroPython on the ESP32?

I'm an experienced Python developer, and a complete newbie at electronics. I got an ESP32 board with MicroPython installed, and a microphone connected to it. I'm able to get a reading off the microphone, like this: MicroPython v1.9.4 on 2018-05-11;…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
3
votes
1 answer

How to build sphinx docs for micropython

How do I configure sphinx to document modules intended for a MicroPython interpreter? The fundamental problem I'm facing is that sphinx gets the information it documents from the imported module. Therefore the python interpreter used to document a…
FraggaMuffin
  • 3,915
  • 3
  • 22
  • 26
3
votes
2 answers

XBee3 Coordinator cannot find End_Device during Network Discovery

Currently, I am running XBee3 International Mesh Kit and tried following the given example in the…
3
votes
4 answers

How to retrieve the flashed binary in ESP8266

I was able to flash a micropython binary which I'd cross compiled some 6 months ago, and it was working fine. It was built from master branch at that point of time, and I did not save the code, nor the binary. Today, when I again compiled, the…
Ouroboros
  • 1,432
  • 1
  • 19
  • 41
3
votes
1 answer

Why is my microbit showing this animation?

I'm running micropython on a bbc microbit. My microbit isn't running the program flashed to it, it's displaying 0, 5, 0, SAD_FACE What does that animation mean?
phil
  • 561
  • 3
  • 10
3
votes
2 answers

return multiple matches using re.match or re.search

I am converting some code to micropython and I got stuck on a particular regular expression. In python my code is import re line = "0-1:24.2.1(180108205500W)(00001.290*m3)" between_brackets = '\(.*?\)' brackettext = re.findall(between_brackets,…
Marc Wagner
  • 1,672
  • 2
  • 12
  • 15
3
votes
2 answers

microbit compass in micropython

I have a microbit project where the microbit is inserted into a kiktronics robot vertically. I would like to get the heading of the robot, but the compass.heading() only works if the microbit is horizontal. I have tried reading the x,y,z…
mksteve
  • 12,614
  • 3
  • 28
  • 50
3
votes
1 answer

Move methods to another Python file

I want to move my methods (method_2 and method_3) from the main.py file to other python files (such as method_2.py and method_3.py) and call them from there. I have an issue that these two functions need uasyncio and uasyncio.asyn modules which is…
Sunrise17
  • 379
  • 3
  • 18
3
votes
1 answer

asyncio with multiple methods in micropython

When I run the following code, it runs and print ("Listening, connect your APP to http://192.168.4.1:8080/") and waiting request as web server. During the web server mode, I want the LED to blink that's why I have applied asyncio. However, unless…
Sunrise17
  • 379
  • 3
  • 18
3
votes
1 answer

Micropython 1.9.3 - How to compile .py @micropython.native code into .mpy?

I'm on Micropython 1.9.3. I know how to use mpy-cross to turn a .py into a compiled python .mpy that can be executed by the Micropython virtual machine. The problem is that if I try to compile using @micropython.native i.e. compile the Python script…
Bob
  • 4,576
  • 7
  • 39
  • 107
3
votes
2 answers

I2C scan with Micropython and NodeMCU 12E returns empty list

I'm trying to hook up a MPU6050 with my NodeMCU board with Micropython flashed in it. My current wiring is the following: MPU6050 Board Vcc 3.3v Gnd Gnd SDA D6 SCL D7 Through the command line, I've tried the…
magicleon94
  • 4,887
  • 2
  • 24
  • 53
3
votes
2 answers

write_analog in microPython on BBC micro:bit does not do anything

I have a simple one line of micro:bit javascript that works, but the same line in microPython does not. I have a potentiometer wired to the micro:bit and the readings from the potentiometer are sent to a pin attached to an LED in order to control…
user2302244
  • 843
  • 2
  • 11
  • 27
3
votes
1 answer

Fill in a slice of a list with certain value without allocating new objects

Is there any way to modify python list through slice with only one value without memory allocations? Something like that: b = range(10) b[2:5] = 1 The problem here is that about memory. I do not want to allocate new objects, because I work with…
Long Smith
  • 1,339
  • 3
  • 21
  • 40
3
votes
2 answers

Python: programmatic class instance variable initialisation with locals()

I have a class with many instance variables with default values, which optionally can be overridden in instantiantion (note: no mutable default arguments). Since it's quite redundant to write self.x = x etc. many times, I initialise the variables…
phoibos
  • 3,900
  • 2
  • 26
  • 26
3
votes
1 answer

Converting Decimal to Binary on the Microbit

I thought it would be a fun idea to turn my BBC Microbit into a digital clock - specifically, a binary digital clock. I knocked up a bit of code in Python to do just that: from microbit import * def makeBinary(intValue,padding): number =…
headbanger
  • 1,038
  • 1
  • 11
  • 32