Skip to content

Instantly share code, notes, and snippets.

View Josverl's full-sized avatar

Jos Verlinde Josverl

View GitHub Profile
import sys
import time
import machine
from neopixel import NeoPixel
np = NeoPixel(machine.Pin(5), 8)
np.fill((0, 0, 0)) # Turn off all LEDs
RED = (255, 0, 0)
@Josverl
Josverl / async-frozen.md
Last active June 30, 2025 23:31
Notes for micropython debugpy
  • frame.f_code.co_filename is a qualified filename with no leading / for frozen modules.

  • attempring to access frame_f_locals in a frozen module causes a crash on ESP32, possibly caused by the fact that mpy files are not compiled with "debug symbols"/ access to local names.

import sys
from collections import OrderedDict as OD
@Josverl
Josverl / bolt.py
Last active April 12, 2025 20:24
bolt.py
# keeps on running
from machine import Pin
import time
import sys
leds = []
for i in range(7):
led = Pin(i, Pin.OUT, value=0)
leds.append(led)
# WIFI
SSID = 'micro'
WIFI_PASSWORD = "Python!!"
# MQTT broker settings
MQTT_BROKER = "192.168.1.55"
MQTT_USER = "micro"
MQTT_PASSWORD = "Python!!"
## 1.24.0 preview mypy flagged isseus
- uasyncio ( multiple)
-"repos/micropython-stubs/tests/quality_tests/feat_uasyncio/check_demo/auart_hd.py":
- "Generator[Any, Any, Any]" not callable
- "Task" has no attribute "cancel"
- Incompatible types in "await" (actual type "Task", expected type "Awaitable[Any]")
- No overload variant of "__setitem__" of "list" matches argument types "int", "str"
- "Generator[Any, Any, Any]" not callable
@Josverl
Josverl / DIY-stubs.md
Last active April 16, 2024 12:19
DIY Stub file creation for MicroPython

DIY Stub file creation for MicroPython

To create stubs for your MicroPython board, you can use the micropython-stubber package. This package will connect to your board and create a set of stub files that you can use in your IDE to get code completion and type checking.

The recomnedation is:

  • To create a folder from which to run the tool and store the various repos and files
  • optionally to create a .venv virtual environment to run the tool in.

install micropython-stubber

@Josverl
Josverl / board_info.csv
Last active January 4, 2024 08:39
Test to measure the performance of reading a MPremote --mounted filesystem
board description
4MB/OTA module with ESP32 GENERIC_OTA
Actinius Icarus with NRF9160 ACTINIUS_ICARUS
Adafruit Feather RP2040 ADAFRUIT_FEATHER_RP2040
Adafruit Feather STM32F405 with STM32F405RG ADAFRUIT_F405_EXPRESS
Adafruit ItsyBitsy RP2040 ADAFRUIT_ITSYBITSY_RP2040
Adafruit Metro M7 with MIMXRT1011DAE5A ADAFRUIT_METRO_M7
Adafruit QT Py RP2040 ADAFRUIT_QTPY_RP2040
Arduino GIGA R1 WiFi with STM32H747 ARDUINO_GIGA
Arduino Nano 33 BLE Sense with NRF52840 ARDUINO_NANO_33_BLE_SENSE
@Josverl
Josverl / _thread.pyi
Last active September 4, 2023 15:54
proposal _threads stub
"""
Manual typestub for _thread module.
multithreading support. See: https://docs.micropython.org/en/v1.20.0/library/_thread.html
|see_cpython_module| :mod:`python:_thread` https://docs.python.org/3/library/_thread.html .
This module implements multithreading support.
This module is highly experimental and its API is not yet fully settled
@Josverl
Josverl / API-Test.ipynb
Last active June 23, 2025 12:40
mpremote API
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Josverl
Josverl / ac_colors.json
Created July 4, 2023 09:41
Adaptive Card with multiple accents / Colors
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Container _WITH_ a select action. Text should show be in color specified in the card in non-HighContrast, and the High Contrast _BUTTON_ color in HighContrast.",
"wrap": true,
"weight": "Bolder"
},