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
1 answer

I can't get a python prompt on ESP8266/nodemcu with micropython

I've flashed several different versions of micropython onto my ESP8266/nodemcu board and I keep getting the following output in a terminal: rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0,…
John Blacker
  • 129
  • 1
  • 10
0
votes
2 answers

json posts in micropython

I use the code below in python on a rpi to do json posts import requests payload = '{"msg_type":"observation_payload","msg": {"serial":"FZtank","observations":{"8":{"d":0,"m":"JSON upload test","t":"1543540780"}}}}' r =…
Kris Mclean
  • 21
  • 2
  • 7
0
votes
4 answers

Connect to ESP8266 running micropython from PUTTY

I am attempting to connect to an ESP8266 Board running micropython with no luck. I have erased and flashed per the instructions in the docs and all instructions found on internet. See below (this is on Windows…
Infinity Cliff
  • 356
  • 2
  • 6
  • 20
0
votes
2 answers

utime.localtime() timestamp MicroPython

I'm trying to get the current timestamp on my Feather Huzzah 32 running micro python. I have read some of the documentation on utime which should be able to get the current timestamp, but I can't seem to figure it…
Dapper
  • 59
  • 3
  • 12
0
votes
0 answers

Write arbitrary POST data to socket with fixed size buffer

Foreword: the code below is micropython and works on a microcontroller, the question is per se, I guess, platform independent and related to how sockets work, which I'm really new. In an application I send data from i2c eeprom to a server using a…
neurino
  • 11,500
  • 2
  • 40
  • 63
0
votes
1 answer

micropython http request on wemos d1 mini

I have a micropython-running Wemos D1 mini project board. I am trying to send a simple HTTP request on another Wemos D1 mini running Easyesp, that has a relay attached to it on pin 5. The request works like…
0
votes
1 answer

ESP8266 with the MicroPython always reboots

I've flashed the MicroPython into the NodeMSU board based on 12E chip and have used the screen command in the terminal on OS X to run the REPL. It works a few seconds and the REPL resets. I have no idea where is the problem ( I can write a few…
pavolve
  • 205
  • 4
  • 12
0
votes
1 answer

How to make iterators and generators work in micropython?

Here's what's happening on my NodeMCU board with ESP8266: >>> x = iter((28,75,127,179)) >>> x.next() Traceback (most recent call last): File "", line 1, in AttributeError: 'iterator' object has no attribute 'next' Same occurs with…
Sergiy Kolodyazhnyy
  • 938
  • 1
  • 13
  • 41
0
votes
1 answer

NameError Using time.sleep in MicroPython

import time from umqtt.simple import MQTTClient from machine import Pin from dht import DHT22 SERVER = 'X.X.X.X' # MQTT Server Address (Change to the IP address of your Pi) CLIENT_ID = 'ESP32_DHT22_Sensor' TOPIC = b'temp_humidity' running =…
Quernon
  • 88
  • 1
  • 8
0
votes
1 answer

How to write a class in Micropython that can be initialized with arguments?

I'm trying to write a class in Micropython that needs to be initialized with an argument, but I'm having trouble figuring out how to do it. I'm using an XBee module with micropython 1.9.4 This is how I'm declaring the class: class myClass: def…
Bruno Ferreira
  • 942
  • 9
  • 22
0
votes
3 answers

Cannot import machine module on MicroPython

When using an ESP8266 and sending files to the board via the WebRepl I can use the machine module when typing directly into the console. However, when I send a Python script that imports the machine module to the board and import it to the console…
Lewis Solarin
  • 11
  • 1
  • 1
  • 4
0
votes
3 answers

Why might an Adafruit CircuitPython board's filesystem fail to mount?

Why would the file system (CIRCUITPY) of an Adafruit board running CircuitPython not show up when connecting it to a suitable host via a micro usb cable?
KevinJWalters
  • 193
  • 1
  • 7
0
votes
4 answers

count words in a .txt then write the results in the same .txt

Im trying to count the amount of words in a text document then write the total back to the .txt here is how far i've got words = 0 f = open("count.txt", 'r+') for wordcount in f.readline().split(" "): words += 1 print('number of words…
Tom HRM
  • 3
  • 3
0
votes
1 answer

Is there a builtin library for moving and replacing a file?

As the title suggests, is there a builtin library for moving a file and replacing an existing file if it exists? I tried os.rename(path1, path2), but that doesn't seem to handle overwriting existing files. Working with a pycom gpy, if that…
Diaonic
  • 151
  • 1
  • 15
0
votes
0 answers

"An instance of object creation occurs when a reference to a bound method is created"

[An instance of object creation occurs when a reference to a bound method is created. This means that an ISR cannot pass a bound method to a function. One solution is to create a reference to the bound method in the class constructor and to pass…
Bob
  • 4,576
  • 7
  • 39
  • 107