Coder Social home page Coder Social logo

jmpinit / p5.axidraw Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 0.0 210 KB

A p5.js library for controlling the AxiDraw pen plotter.

Home Page: https://jmpinit.github.io/p5.axidraw/

License: MIT License

JavaScript 100.00%
p5 p5-js p5-library p5js pen-plotter plotter-art plotters web-serial webserial

p5.axidraw's Introduction

p5.axidraw

A p5.js library for controlling the AxiDraw pen plotter via the WebSerial API.

Usage

Upload the latest release as a file in your sketch and then reference it from index.html like so:

<head>
  ...
  <script src="p5.axidraw.js"></script>
  ...
</head>

An example sketch that connects to the AxiDraw when the mouse is clicked and draws a diagonal line:

const axi = new axidraw.AxiDraw();
let connected = false;

function setup() {
  createCanvas(400, 400);
}

function mouseClicked() {
  if (!connected) {
    // Note: connect() must be called from a user gesture (e.g. a mouse click) due to
    // browser security restrictions
    axi.connect()
      .then(() => {
        connected = true;
      });
  }

  // Draw a diagonal line
  axi.penDown();
  axi.moveTo(10, 10);
  axi.penUp();
  
  // Draw a diagonal line, but async
  
  // axi.penDown()
  //   .then(() => axi.moveTo(10, 10))
  //   .then(() => axi.penUp());
}

See the examples directory for more.

Documentation

See jmpinit.github.io/p5.axidraw for the API docs.

p5.axidraw's People

Contributors

jmpinit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

p5.axidraw's Issues

AxiDraw SE/A1 with Brushless Servo Upgrade is not supported to control pen up/down

axi.moveTo() works great however the axi.penUp() and penDown() shows no response.

My hypothesis is that the SE/A1 with Brushless Servo upgrade requires a different configuration. See equivalent config additions here that were added to the Python library:

https://axidraw.com/doc/py_api/#api-changelog

v 3.8 (2023-01)
Added new [penlift](https://axidraw.com/doc/py_api/#penlift) option, to enable brushless servo option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.