This is the MicroPython port of Python Thermal Printer by Adafruit, available elsewhere on GitHub.
Read the full story at https://kapusta.cc/2017/12/11/thermal-printer-library-for-micropython/.
- Removed Python 2.x code
- Removed
writeToStdout()
- Replaced
Serial
withmachine.UART
- Removed support for pre-2.68 firmware
- Removed image printing method, because it depended on Python Imaging Library
- Disabled calls to
wake()
andreset()
at initialization - Fixes to
sleepAfter()
andwake()
printBitmapFromFile()
- allows for printing the bitmap from file on disk, instead of reading it from array of bytes likeprintBitmap()
does.printBMPImage()
- allows for printing the actual .bmp image. Supports 1-bit Windows BMP format only, up to 384px wide.- heat dots, heat time and heat interval settings are parametrized in the initializer to fine tune printer output.
See printertest.py for usage example.
So far I tested it only with LoPy version 1. Works fine, besides printing large bitmaps that required too much memory for the LoPy (for the bitmap provided with printertest.py) - hence printBitmapFromFile()
.