MicroPython | All of my MicroPython stuff | Web Services library
kandi X-RAY | MicroPython Summary
kandi X-RAY | MicroPython Summary
All of my MicroPython stuff
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- \ x1b
- Resolve path
- Convert a line to a list of arguments
- Get the mode of a file
- Start the device
- Enable gesture mode
- Reset counts
- Set the value of a bit
- Draw a line
- Loops the file
- Readgesture
- Send qdata
- Draw a string on the screen
- Display the screen
- Process character
- Updates the display
- Run test
- Show check status
- Set the speed of the motor
- Print a file
- Set the current speed
- Main loop
- Display the object
- Draws a string on the screen
- Update the circle
- Remove file or directory
- Display a lidar display
MicroPython Key Features
MicroPython Examples and Code Snippets
Community Discussions
Trending Discussions on MicroPython
QUESTION
I have the following MicroPython code running on an ESP32:
...ANSWER
Answered 2022-Apr-17 at 15:02I am also a little suspicious of the bytes retrieved from wlan_sta.config('mac'). I would have expected something that looked more like b'\xaa\xbb\xcc\x11\x22\x33' instead of b'0\xae\xa4z\xa7$'. The z and the $ seem very out of place for something that should be hexadecimal and it seems too short for what should be six pairs of digits.
You're not getting back a hexadecimal string, you're getting a byte string. So if the MAC address contains the value 7A
, then the byte string will contain z
(which has ASCII value 122 (hex 7A
)).
Am I using the correct method to get the MAC address?
You are!
If it is correct, how can I format it as six pairs of hex digits?
If you want to print the MAC address as a hex string, you can use the
ubinascii.hexlify
method:
QUESTION
I was working with micropython on a SEEED XIAO (SAMD21) using version 1.18, and wanted to use 'compiled' libraries (.mpy
) to conserve space. I had mpy-cross for version 5 which worked okay for me. I also wanted to have floating point so I built a new micropython with that option- from the latest (20220302) github version- and noticed that mpy-cross had updated to version 6. I thought I would check to see which versions of .mpy
were used The micropython documentation suggests some code to check the version of .mpy
using the sys.implementation
object. I noticed a variety of sys.implementation
implementations.
Version 1.18- released by micropython 20220117 on the XIAO SAMD21 gave the following results:
...ANSWER
Answered 2022-Mar-27 at 18:05If you want to use precompiled/bytecode .mpy files then you will need to Decide to use either bytecode or compile to native code for your mcu platforms.
For bytecode you will need to distribute a bytecode version that matches the runtime firmware, 1.12-1.18 == 5, next version will increase
For native code you'll need to distribute versions for each platform that you want to support. An esp32c3 cannot run stm32 native code and vice-versa
Also the different ports/board will indeed have differences in some of the stdlib APIs. Your code must be robust enough to handle these differences.
QUESTION
I am trying to create a file in an ESP32 named "PassWord" containing a password, using Micropython Serial. The code below works with a "hardwired" password, but I would like to be able to send the contents of a variable that was typed in by the user. The sending script is running in Win10 using Python 3.7.9
...ANSWER
Answered 2022-Mar-06 at 21:19You could do something like this. Just made this as an exaggerated example so you can learn. You could put this whole thing into the send function input if you wanted.
QUESTION
I built a webpage on an ESP32 chip, charged to create an access point allowing my computer to connect in order to access this page.
For the moment I can only access it using the IP of my ESP by typing it in a browser but it can be very bothersome.
I'd like to know if it was possible to change the url of the page using words instead of the ESP's IP.
Maybe I'm missing some technical terms but I didn't find any solution on the internet.
PS: I'm using micropython with sockets to serve html files from the board:
...ANSWER
Answered 2022-Feb-26 at 19:31Certainly. The easiest option is enabling mDNS. This allows hosts in the same local network to resolve the device's name (e.g. espressif.local
) into its IP. Only works in local network and requires an mDNS client on the computer (Mac, Linux and Windows all tend to have it built in these days).
No idea how to do it in Micropython, though. Give Google a try.
QUESTION
Basically I'm just trying to figure out how an spdt switch would work with a raspberry pi pico. When I search for information on how to interface a switch with a pico, all I get is info on button switches.
Does the spdt switch act like a closed circuit, constantly providing power to the pin I connect it to?
Assuming the answer to the question above is "yes", how would I go about telling micropython to do different things based on which pin is receiving power?
Sorry for the simple questions, I have no experience in the domain of microcontrollers and can't find this info anywhere.
...ANSWER
Answered 2022-Feb-23 at 12:37A switch -- by itself -- doesn't provide power to anything. All it does is close and open a circuit. You can replace the switch with a wire and connect/disconnect the wire and accomplish the same thing.
If you had the middle pin of the switch connected to GPIO 2, and the two outer pins wire to Ground and Vcc, you could use the switch to switch the value of the GPIO between logic 0 and logic 1.
Reading the value would look something like this:
QUESTION
This is code that waits for an event coming from button A.
control.waitForEvent(Button.A, EventBusValue.MICROBIT_EVT_ANY)
I want to wait for either button A OR button B to be pressed.
Is this possible?
EDIT
I know that in Scratch
this is possible with something like button.any
, also the above code is written in microjavascript
, but it is written similarly in micropython
, so maybe someone from this field can also help. Thank you.
ANSWER
Answered 2021-Dec-28 at 20:08Have a look at the python code generated using the 'on event from' block in https://makecode.microbit.org. This block can be found under the Advanced tab. The block can be set to wait for either button A or B to be pressed. The micropython code generated in this case is:
QUESTION
I am following the documentation for building micropython
...ANSWER
Answered 2022-Feb-09 at 12:32For some reason the installer did not put the binaries in my path. I fixed this with
QUESTION
I'm trying to read all files with .asm
and .py
extensions in an sd card using MicroPython.
I checked the answers in this question but they don't work with MicroPython.
MicroPython doesn't have glob
nor pathlib
and when using os
library and try this code:
ANSWER
Answered 2022-Feb-02 at 14:08your on the right track, os.listdir
works just fine on any version of MicroPython, but does not recurse the sub-folders.
so you need to distinguish a folder from a filenode as in the below.
QUESTION
I'm trying to work with the Tronpy module in Micropython. It works fine when I'm using CPython. However, in Micropython, I tried to install it and got an error message. I'm using Fedora 34.
...ANSWER
Answered 2022-Feb-02 at 15:49It appears that you are attempting to upip install a CPython module on MicroPython. (sorry , could have seen that sooner)
That will not work - unless that module is packaged specifically for MicroPython.
The error message could be clearer though...
I would suggest searching PyPi for MicroPython specific packages, either through the micropython-
prefix or using the programming language filter:
lastly: in upip you can enable some debug messages by setting upip.debug = True
as in the below sample
QUESTION
Using a Expressif dev-board and standard micropython.bin I was able to create a littlefs2 partition, mount it and write data into a file:
...ANSWER
Answered 2022-Jan-31 at 22:27if reformat with vfsFat is close enough to 'getting rid of' you can do the following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MicroPython
You can use MicroPython like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page