UNPKG

@thi.ng/axidraw

Version:

Minimal AxiDraw plotter/drawing machine controller for Node.js

59 lines (58 loc) 816 B
const START = ["start"]; const STOP = ["stop"]; const HOME = ["home"]; const RESET = ["reset"]; const ON = ["on"]; const OFF = ["off"]; const SAVE = ["save"]; const RESTORE = ["restore"]; const PEN = (posDown, posUp) => [ "pen", posDown, posUp ]; const UP = (delay, level) => [ "u", delay, level ]; const DOWN = (delay, level) => [ "d", delay, level ]; const MOVE = (pos, speed = 1) => [ "M", pos, speed ]; const MOVE_REL = (delta, speed = 1) => [ "m", delta, speed ]; const WAIT = (delay = 1e3) => ["w", delay]; const COMMENT = (msg) => ["comment", msg]; function* complete(commands) { yield START; yield* commands; yield STOP; } export { COMMENT, DOWN, HOME, MOVE, MOVE_REL, OFF, ON, PEN, RESET, RESTORE, SAVE, START, STOP, UP, WAIT, complete };