Bluetooth LE Printers
Some wireless receipt printers come with Bluetooth Low Energy support, and you can use these with Espruino Bluetooth LE devices using the ble_printer (About Modules) module as follows:
var printer = require("ble_printer");
// Some graphics to print
var g = Graphics.createArrayBuffer(256,32,1,{msb:true});
g.setFontVector(32);
g.drawString("Espruino!");
// Connect to nearest Printer
NRF.requestDevice({ filters: [{ services: ['18f0'] }] }).then(function(device) {
// When connected print 'Hello World' text, and then the graphics
printer.print(device, "Hello World\n" + printer.getGraphics(g), function() {
print('Done!');
});
});
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.