dc7211ad93febbedae1a83606fb074dd2a2fc86d
p5-wallplotter
p5.js library for a Marlin polargraph (wall plotter) over Web Serial, plus a zigzag example.
Anleitung (Download, Linux/Windows/macOS, USB, Marlin/G-code): tutorial.md. Hardware: hardware.md. G-code: gcode.md.
p5-wallplotter/
├── tutorial.md # setup + plotter + G-code
├── unterricht/ # three workshop assignments
├── hardware.md # motors, board, geometry
├── gcode.md # G-code used by this setup
├── plotter.svg # devices + signal path
├── lib/
│ ├── WallPlotter.js # library
│ ├── README.md # short intro + example
│ └── doc.md # full API
├── examples/
│ ├── zickzack/ # example sketch
│ └── rechteck/ # rectangle sketch
└── sketches/ # your sketches
Run the example
Chrome or Edge. Serve over localhost (Web Serial does not work from file://).
cd p5-wallplotter
python -m http.server 8080
Open http://localhost:8080/examples/zickzack/
Press C to connect, H to set home, then Test (preview) or Plot (send G-code).
Use in a sketch
<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);
}
Full API: lib/doc.md.
Baud 115200. Pen servo: M280 P0 S90 up, M280 P0 S50 down. Coordinates in mm, origin at home (G92).
Languages
JavaScript
100%