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
1
vote
0 answers

Pi Pico W Cant connect to wifi

Hey my problem: I have an Raspberry Pi pico w and it is used as an access point and web server where users can enter SSID and password of a WLAN they want the rasi to connect with. The data of the form gets send back and the raspi should then turn…
1
vote
0 answers

How do I load official modules with uFlash into the BBC micro:bit?

I've been coding the BBC micro:bit with the micro:bit Python Editor with no problems. Now I'm working with a more modest computer, and would like to code with emacs+uflash. My problem is that when I upload the firmware with uflash, and try to import…
Luis López
  • 159
  • 8
1
vote
2 answers

Is there a way to make python not wait for function to finish?

I have just started with programming on a raspberry pi pico, and I was wondering if you can make python start another function, even though the other one is still running, so I want multiple functions to run at once (but with a bit of delay between…
luuf
  • 29
  • 5
1
vote
0 answers

How can I interrupt a Timer which runs a function continuously in Micropython?

I am running a Timer periodically to read from multiple ultrasonic sensors. This is done in Micropython on a Raspberry Pi Pico W. The time this read takes is dependent on the distance of the nearest object to the sensor. The further away, the longer…
1
vote
0 answers

Error loading main.py to MicroPython on NodeMCU Lilin V3

I have a NodeMCU board and I'm trying to use it for IoT. I'm using mac and this is the commands I'm using to install MicroPython: esptool.py --port /dev/cu.usbserial-110 erase_flash esptool.py --port /dev/cu.usbserial-110 --baud 115200 write_flash…
Alexgar
  • 21
  • 3
1
vote
0 answers

Blank payload when sending POST via Micropython

I want to call POST from micropython to Django webserver. The POST payload shows up as empty when called from the micropython code. When the same code is ran with C-Python, it does show up with the filled payload. Here is the micropython code…
RKs
  • 173
  • 1
  • 1
  • 10
1
vote
0 answers

Subclassing weird behavior in CircuitPython

Some background: In MicroPython there is a class called Pin which controls I/O pins. In CircuitPython a similar class is called DigitalInOut. So for compatibility I wrote this simple class. Unfortunately, something goes wrong with my implementation.…
ishahak
  • 6,585
  • 5
  • 38
  • 56
1
vote
1 answer

Run task once at 14:00 everyday or as soon as possible if sleeping

How would I run a task using just the date and time so that it runs only once but also is ran even if the exact time doesn't match because the program has been sleeping? I can do an if hour and if minute and if second but I'm sleeping between loops…
1
vote
1 answer

Micropython RuntimeError: maximum recursion depth exceeded

I'm not using recursion but I think some third party code I'm using has to many nested function calls. This is the code I used as an example to create my project https://github.com/ehong-tl/micropySX126X I could create a cut down example but I don't…
David P
  • 411
  • 7
  • 21
1
vote
1 answer

micropython client from raspberry pi pico cannot connect to local host

I have a node.js server in which I am trying to send data in real time from my raspberry pi pico w over sockets. My Simple Server is setup as follows: const express = require("express") const app = express(); const http = require("http"); const {…
1
vote
0 answers

Read USB port on Raspberry Pi Pico with alternative to pyserial

I'm trying to read out a USB-connected device hooked onto my Raspberry Pi Pico using Micropython. In CPython it's quite easily done using the pyserial lib: import serial # <-- the problem: not available in micropython? ser = serial.Serial() …
Juliën
  • 9,047
  • 7
  • 49
  • 80
1
vote
1 answer

Micropython: asyncio Server: get Client IP address

I am new in micropython and testing it out, if it can fit the needs for my next project. I have set up a script to test it and there I run three async jobs in an endless loop. one of them is a tiny webserver, which should act as an API. The…
kamp
  • 41
  • 4
1
vote
1 answer

uasyncio.create_task does not run coroutine (micropython)

Before I start an issue on github, just wanted to know, if I am doing smth wrong. This basic example should start a loop and after one calls the stop method it should stop. However, the print("while loop") gets not executed at all. rp2040 Zero…
webdeb
  • 12,993
  • 5
  • 28
  • 44
1
vote
1 answer

Use micropython as interpreter in VSC (for raspberry pi pico)

I have recently gotten a raspberry pi pico and would like to use Visual Studio Code instead of Thonny to create and run my scripts that will control the components of my board. (The pico is connected to my laptop via USB) So far i have tried using…
1
vote
2 answers

Calculate acceleration and deceleration while traveling from A to B

I am using code like the example below to simulate travel from one point to another. The goal I want to achieve is have a realistic acceleration and deceleration at the beginning and end of trip regardless of the length of trip, while in the middle…
Bubs
  • 11
  • 2