To complement my project "shopping list" i need of course also a possibility to print it out. The ESP32 is bloetooth-capable and annex-basic supports it well, it makes sense to use a bluetooth printer, I thought
I found the MPT-II on the "Ali". Is cheap - has a built-in battery and supports Bluetooth and USB´
On github I found some control codes and made a small test program out of them - so far I only found the code for normal text and bold text and of course the initialization sequence
Code: [Local Link Removed for Guests]
bluetooth.clear
BLUETOOTH.SETUP "ESP32_Device"
IOBUFF.DIM(1, 1000) ' Puffer für Texte
NewOrder$=""
Art1$ = "Butter" : Art2$ = "Bread": Art3$="Onions" : Art4$="Milk" : Art5$ ="toilet paper" :Art6$="":Art7$ = "" : Art8$ = "": Art9$="" : Art10$="" : Art11$="":Art12$=""
NewOrder$=Art1$+chr$(10)+Art2$+chr$(10)+Art3$+chr$(10)+Art4$+chr$(10)+Art5$+chr$(10)+Art6$+chr$(10)+Art7$+chr$(10)+Art8$+chr$(10)+Art9$+chr$(10)
file.save "/DatenT/Orders.dat",NewOrder$
onbluetooth ble_receive
bluetooth.scan 5
pause 600
bluetooth.client "66:22:F5:FA:C9:36", "18f0", "2af1"
pause 250
wait
ble_receive:
pause 50
select case bluetooth.status
case 1
wlog "------> Verbunden!"
' --- Initialisierung (nur einmal!) ---
iobuff.fromhex(1, "1B40") ' ESC @ = Reset
bluetooth.clwrite_iobuff "2af1", (1)
pause 100
' --- Fettdruck für ALLE folgenden Texte ---
iobuff.fromhex(1, "1B4501") ' ESC E 1 = Fett AN
bluetooth.clwrite_iobuff "2af1", (1)
pause 50
' --- Texte drucken (mit Zeilenumbruch chr$(10)) ---
text$ = "Hallo Drucker! Dies ist ein Test" + chr$(10)
iobuff.fromstring(1, text$)
bluetooth.clwrite_iobuff "2af1", (1)
text2$ = "Und dies ist Zeile 2" + chr$(10)
iobuff.fromstring(1, text2$)
bluetooth.clwrite_iobuff "2af1", (1)
pause 50
'iobuff.fromhex(1, "1B4500") ' ESC E 1 = Fett aus
' bluetooth.clwrite_iobuff "2af1", (1)
'pause 50
text4$=file.read$("/DatenT/Orders.dat")
rem text$ = "Hallo Drucker!Dies ist Test 3 " + chr$(10)'prüfe ausschalten fettdruck
iobuff.fromstring(1, text4$)
bluetooth.clwrite_iobuff "2af1", (1)
case 2
wlog "====== Verbindung getrennt- verbinde"
bluetooth.client "66:22:F5:FA:C9:36", "18f0", "2af1"
pause 250
end select
return
Ron PS:https://github.com/bitbank2/Thermal_Printer/tree/master