Micropython Gotchas
summary
A thermal printer project runs on a Pycom LoPy (ESP32) with 512 KB RAM and 4 MB flash but fails on an esp8266 ~25KB RAM because bytecode compilation consumes RAM; using mpy-cross to precompile and freezing modules fixes that. UART APIs differ across ports—ESP8266 implementation rejects pins and UART construction varies—time functions return integer seconds on some ports and ticks_diff argument order swaps on others, so a small platform-detection shim and platform-specific modules make the code actually work.
AI-written summary · about
chapters (16)
- 0:00Start
- 3:58MicroPython port
- 5:42Hardware again
- 6:17Let's run it!
- 6:33Fact #1
- 7:22Crosscompile
- 7:35Prepare the cross compiler
- 7:47Compile, upload
- 8:21Configure UART
- 8:47The library code
- 10:32Solution
- 12:29Suspicious code usage
- 16:03Suspicous code (again)
- 16:55ESP8266
- 19:27Summing up
- 21:08Let's talk about UART








