jlc-slomo-elite
v1.0.0-beta.11
Published
Library for integration with JLC Slomo Elite
Downloads
94
Readme
JL Cooper SlomoElite Library
Example code
async function run() {
const jlc = new JLCSlomoElite('COM4');
await jlc.open();
await jlc.clear();
await jlc.writeText('Jojo!', { fontSize: FontSize.Large, inverted: false, x: 10, y: 10, spacing: 1});
console.log(await jlc.requestSystemInfo());
await jlc.setShuttleMode(ShuttleMode.Automatic);
await jlc.setTBarResolution(TBarResolution.Bits10);
await jlc.drawObject(ObjectType.FilledRectangle, { x: 10, y: 100, width: 100, height: 100 }, 1, false);
/* Render some pixels to back buffer */
await jlc.setRenderMode(RenderMode.RAM);
const pixels = new Uint8Array(300 * 4).fill(0xff);
await jlc.drawPixels(0, 0, 300, pixels);
await jlc.requestTransferRAMToDisplay();
/* Transfer complete, reset render mode */
await jlc.setRenderMode(RenderMode.Display);
setInterval(() => {
jlc.writeText(`${Date.now()}`, { fontSize: FontSize.Medium, inverted: false, x: 10, y: 30, spacing: 1});
}, 1000);
}
run().catch(console.error);