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
0
votes
0 answers

Micropython NAT between interfaces on ESP8266

I want to build a WIFI repeater using ESP8266 and Micropython I already started an interface on AP mode and another on STA mode and connected the last one to my router, but seems that Micropython doesn't route the packages between interfaces and…
0
votes
1 answer

Opening .py files with micropython on TI Nspire

I uploaded Fabian Vogt's micropython port to my TI Nspire CX CAS, together with a couple of *.py.tns files to try. I can't find a way to load/launch those files. As micropython does not include the os module, I can't use os.chdir to change the…
YAG
  • 103
  • 6
0
votes
1 answer

Python: self randomly not defined

I am running my code with micropython on that camera: OpenMV Camera I randomly get the error in python that self is not defined. This is how my python code looks like: (the whole file would be too long) class BlobAnalyser: # #constructor and lots of…
desireentz
  • 29
  • 3
0
votes
1 answer

Why NodeMCU sends data with unwanted number?

I am trying to send a serial data from NodeMCU to Arduino. I use MicroPython to program. As well as Serial.read on Arduino. I can send and receive successfully. But the problem is the NodeMCU sends data along with number which is not needed. And…
nawas
  • 41
  • 1
  • 10
0
votes
1 answer

TypeError: can't convert to int - Micropython

I have arithmetic issues with micropython. from microbit import * counter = 0 while True: display.show('8') if accelerometer.was_gesture('shake'): display.clear() sleep(1000) counter = counter + 1 …
Cody Raspien
  • 1,753
  • 5
  • 26
  • 51
0
votes
0 answers

Micropython: Non-Blocking SSLSocket

I was just trying SSL-Sockets in Micropython and discovered that I can not set the connection to non-blocking as the setblocking() function is not implemented, yet. >>> import ussl >>> import usocket >>> s = usocket.socket() >>> adr =…
MrLeeh
  • 5,321
  • 6
  • 33
  • 51
0
votes
1 answer

RSSI value using MicroPython in NodeMCU ESP8266

How to get the RSSI value of the WLAN device connected to WiFi of my NodeMCU device using MicroPython? Actually I tried the following code but I'm getting an error: >>> sta_if.ifconfig() ('192.168.1.103', '255.255.255.0', '192.168.1.1',…
Jagdish Chauhan
  • 129
  • 1
  • 10
0
votes
1 answer

while loop within if statement condition

I'm really struggling to finish the last part of my code. Here's some background. This code looks for an object that's in front of it via an ultrasonic sensor, and if there is, it logs that onto an internet database via http_get, if there isn't an…
LukeVenter
  • 439
  • 6
  • 20
0
votes
2 answers

Precompile main.py with the micropython binary image for esp8266

There is boot.py available by default in the micropython image. I have tested a code, in the python module main.py. I would like to do the following I would like to compile a image, so it makes it easier to flash it to more than 10 devices and I do…
akrv
  • 55
  • 11
0
votes
1 answer

How does this macro work?

In this Python implementation for microcontrollers, they use C-macro like follows: MP_ROM_QSTR(MP_QSTR_mem16) with: #define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q) and: #define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2)) My issue…
ARF
  • 7,420
  • 8
  • 45
  • 72
0
votes
1 answer

Decoding hex returns (some) unexpected values

I am performing a Bluetooth scan from a SiPy board using Pymakr. The console returns unexpected values when decoding the returning advertisements. from network import Bluetooth bluetooth = Bluetooth() bluetooth.start_scan(30) while…
Mathias
  • 578
  • 2
  • 8
  • 15
0
votes
0 answers

ValueError when converting string received from Micro:bit radio into integer in Python

I am writing a program for a client that receives a string of an average from a server through the built in radio of averages which the client records. I get a ValueError saying "invalid syntax for integer with base 10" in a line where I attempt to…
bk122474
  • 13
  • 1
  • 4
0
votes
1 answer

Slow detection of radius Network Dot Beacon

I'm trying to use a WiPy board as a BLE scanner and we're detecting some extrange behaviours on radius Network Dot beacons. We are trying with several beacon manufacturers, all emiting as iBeacon with an advertising interval of 100ms (10 per…
Eylen
  • 2,617
  • 4
  • 27
  • 42
0
votes
2 answers

microPython Formating a number without float

I don't have the luxury of floating point precision and are very limited on code space / ram / speed etc. TMP = 2562 DEG = str(int(TMP/100))+'.'+str(TMP % 100) print(DEG) >> 25.62 Is there a more pythionc way of achieving this formatting ?
crankshaft
  • 2,607
  • 4
  • 45
  • 77
0
votes
2 answers

Micropython strings

Using Micropython sockets I received a message which contained the following string: b'xxx/yyy' I don't know how the "b" got there, or what it is !!! I can also enter this using an input statement x = input('Enter:') >>> b'xxx/yyy' …
user1530405
  • 447
  • 1
  • 8
  • 16