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

Has anyone translated this to MicroPython - IR receiver reader

This website http://www.esp32learning.com/code/esp32-and-infrared-receiver-example.php uses Arduino code to read the data from an IR transmitter (remote control/wand). Has anyone done the same for MicroPython?
-1
votes
1 answer

Generating JWS token in python (Example in C)

Hi I have this code from this article https://medium.com/@alexastrum/firebase-auth-for-iot-devices-286679a8b59e I was wondering what the equivalent python code would be thanks. String getDeviceToken() { String header = ""; DynamicJsonDocument…
GILO
  • 2,444
  • 21
  • 47
-1
votes
2 answers

Interfacing Loadcell and Sparkfun's Qwiic Scale NAU7802 with ESP32

I am currently working on a IOT Project in which I am trying to interface Loadcell and Sparkfun's Qwiic Scale NAU7802 so that I can read Weight and Show it on Seven Segment Display. For this I connected Following Pins :- ESP32 Pin Qwiic Scale…
BoGTx0705
  • 11
  • 1
  • 4
-1
votes
1 answer

How to send data over CAN-Bus using ESP32 Module using MicroPython?

I have an ESP32 module connected to my computer. I am using Thonny IDE to program my ESP32 device using micropython code. I am trying to send data over CAN bus but I m getting error. code: from machine import CAN can = CAN(mode=CAN.NORMAL,…
Alok Mishra
  • 694
  • 5
  • 20
-1
votes
2 answers

How can I use Intellisense in VSC with pybricks (micropython)?

I want to use it to code my EV3 brick. I read all the answers on stackoverflow for similar questions, but none of them helped.
-1
votes
1 answer

Python: convert from INT to BYTES issue

there is some strange while converting from INT to BYTES. the function i used to convert: (int).to_bytes(byte lenght,'big') in my specific cases i tried to convert 31 to Bytes, it showed: b = (31).to_bytes(1,'big') b b'\x1f' but when i convert the…
-1
votes
1 answer

asyncio stream vs synchronous stream in socket communication with a react native app

Objective is esp32 running micropython acts as a server while android app acts as a client. Before asyncio stream I am able to communicate successfully, but after switching to asyncio i fail to do so, only android app to esp32 is successful but app…
-1
votes
1 answer

Not usual bytes to string decoding. How to?

I'm working with some interesting devices and some of them uses micropython and on this part have problem with encodings. I need to make two devices communicating by UART-protocol. First device (may it be Nextion Display) sends to second device…
-1
votes
2 answers

Why am I getting a TypeError: 'int' object not callable in a micro:bit MicroPython program?

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…
LuisAFK
  • 846
  • 4
  • 22
-1
votes
2 answers

How to loop with button input, cycle between different options in python?

I have a loop that takes a three way switch input and selects an option on power up of a camera: # Set GPIO input switchColorOne = pyb.Pin("P9", pyb.Pin.IN, pyb.Pin.PULL_UP) switchColorTwo = pyb.Pin("P7", pyb.Pin.IN, pyb.Pin.PULL_UP) #Set color…
-1
votes
2 answers

'TypeError: function missing 1 required positional arguments' : Ultrasonic distance sensor interfacing with Rasberry Pi Pico

I am trying to read distance using Raspberry Pi Pico and ultrasonic distance sensor. While running the code in Thonny, I am getting the error, TypeError: function missing 1 required positional arguments The code is as below: from machine import…
-1
votes
1 answer

button keeps getting high without pressing it

I am working on a project, with MicroPython. Hardware: LoPy 4 + 3.0 expansion board, 1 button, 1 led, 2 resistors (1k) Schematic (Red wires are P13 and P15) And my code: import machine from machine import Pin import time button1 = "P13" LED =…
Zino
  • 1
  • 4
-1
votes
2 answers

Button (GPIO) Pressing Logic in MicroPython

I had another question open about iterative menu logic, and the problem morphed into button logic, so I'm separating them, since the original question was truly settled. My code is as follows: """ fit: a productivity logger """ import time import…
-1
votes
1 answer

Micropython how to play buzzer sound longer?

I'm almost done with a project but when I give a value that is to high. I barely hear de buzzer playing because it only plays for a sec. Does someone know how to play the buzzer sound longer? import pycom import machine import time from machine…
Zino
  • 1
  • 4
-1
votes
2 answers

How to use for in and if statement with loop

I have a little problem with variables and statements. So i'm working on a project and I have to use different statements. Materials: Pycom Lopy4 + 3.0 expansion board, Flexiforce weightsensor, LoRa This is my code now: import pycom import…
Zino
  • 1
  • 4