Files
p5-wallplotter/lib

WallPlotter library

p5 helper for a Marlin polargraph over Web Serial. Coordinates are mm. Origin is machine home (G92). Y positive is up. Chrome or Edge, page on localhost or HTTPS.

<script src="https://cdn.jsdelivr.net/npm/p5@1.11.3/lib/p5.min.js"></script>
<script src="../../lib/WallPlotter.js"></script>
<script src="sketch.js"></script>
let wp;

function setup() {
  createCanvas(windowWidth, windowHeight).parent('sketch-host');
  wp = new WallPlotter();
  wp.setSpeed(3000, 1500);
  wp.enableKeyInputs();
  wp.enablePlotButtons();
}

function draw() {
  background(28, 28, 32);
  wp.showInfos();
}

async function plot() {
  await drawPlot(false);
}

async function test() {
  await drawPlot(true);
}

async function drawPlot(testOnly) {
  wp.startPath();
  wp.move(-200, -200);
  wp.draw(200, -200);
  await wp.runPath(testOnly);
}

Press C to connect, H to set home, then Test. Plot and Bounding box appear after a preview exists.

Example sketches: examples/zickzack/, examples/rechteck/. Full API: doc.md.