<commit_before><h1 align="center">:electric_plug::pencil2: XY</h1>
<h3 align="center">node.js for makeblock XY plotter v2.0</h3>

<div align="center">
  <!-- License -->
  <a href="https://raw.githubusercontent.com/arnaudjuracek/xy/master/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License" />
  </a>
</div>

<!-- 
## Features
- [./firmware](https://github.com/arnaudjuracek/xy/tree/master/firmware) : custom Arduino firmware
  - boundaries defined by the plotter's limit switches
  - pen's servo auto-sleep to prevent wear-out
  - faster _home_ command
- [./lib](https://github.com/arnaudjuracek/xy/tree/master/lib) : node.js library
  - SVG support
  - [Processing-like API](https://processing.org/reference/) for 2D primitives (see [API](#api) below)
  - commands chaining for better readability -->

## Table of contents
- [Installation](#installation)
  - [Node](#node)
  - [Firmware](#firmware)
  - [Server](#server)
- [Usage](#usage)
  - [With a node.js script](#with-a-nodejs-script)
  - [With the raspberry-pi server](#with-the-raspberry-pi-server)
- [API](#api)
- [Contribute](#contribute)
- [Credits](#credits)
- [License](#license)

## Installation

### Node
```sh
npm install --save arnaudjuracek/xy
```
<sup>please note that this module has not been tested with the official makeblock firmwares</sup>



### Firmware
- download and install the [Arduino Software](https://www.arduino.cc/en/Main/Software)
- open [./firmware/firmware.ino](https://github.com/arnaudjuracek/xy/tree/master/firmware/firmware.ino)
- upload it to your board, making sure you've selected the right port and board (_Leonardo_ or _Uno_ depending of your configuration)
- if you want to go back to the official firmware, use the [mDrawBot software](https://github.com/Makeblock-official/mDrawBot)

<sup>please note that this firmware has not been tested with the official makeblock softwares</sup>

### Server
Although you can control the plotter using any node.js script on your client computer (see [usage with a node.js script](#with-a-nodejs-script)), I prefer to use a raspberry-pi server to handle the commands buffer.
```sh
# todo
```

## Usage

### With a node.js script
```js
var plotter = require('xy-plotter');
var job = plotter.Job('my-job-name');

job.rect(10, 10, 100, 100).circle(10, 10, 100);
job.pen_down().move(100, 100);
<commit_msg>update instantiation method in README.md<commit_after><h1 align="center">:electric_plug::pencil2: XY</h1>
<h3 align="center">node.js for makeblock XY plotter v2.0</h3>

<div align="center">
  <!-- License -->
  <a href="https://raw.githubusercontent.com/arnaudjuracek/xy/master/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License" />
  </a>
</div>

<!-- 
## Features
- [./firmware](https://github.com/arnaudjuracek/xy/tree/master/firmware) : custom Arduino firmware
  - boundaries defined by the plotter's limit switches
  - pen's servo auto-sleep to prevent wear-out
  - faster _home_ command
- [./lib](https://github.com/arnaudjuracek/xy/tree/master/lib) : node.js library
  - SVG support
  - [Processing-like API](https://processing.org/reference/) for 2D primitives (see [API](#api) below)
  - commands chaining for better readability -->

## Table of contents
- [Installation](#installation)
  - [Node](#node)
  - [Firmware](#firmware)
  - [Server](#server)
- [Usage](#usage)
  - [With a node.js script](#with-a-nodejs-script)
  - [With the raspberry-pi server](#with-the-raspberry-pi-server)
- [API](#api)
- [Contribute](#contribute)
- [Credits](#credits)
- [License](#license)

## Installation

### Node
```sh
npm install --save arnaudjuracek/xy
```
<sup>please note that this module has not been tested with the official makeblock firmwares</sup>



### Firmware
- download and install the [Arduino Software](https://www.arduino.cc/en/Main/Software)
- open [./firmware/firmware.ino](https://github.com/arnaudjuracek/xy/tree/master/firmware/firmware.ino)
- upload it to your board, making sure you've selected the right port and board (_Leonardo_ or _Uno_ depending of your configuration)
- if you want to go back to the official firmware, use the [mDrawBot software](https://github.com/Makeblock-official/mDrawBot)

<sup>please note that this firmware has not been tested with the official makeblock softwares</sup>

### Server
Although you can control the plotter using any node.js script on your client computer (see [usage with a node.js script](#with-a-nodejs-script)), I prefer to use a raspberry-pi server to handle the commands buffer.
```sh
# todo
```

## Usage

### With a node.js script
```js
var plotter = require('xy-plotter')();
var job = plotter.Job('my-job-name');

job.rect(10, 10, 100, 100).circle(10, 10, 100);
job.pen_down().move(100, 100);

{'fraction_non_alphanumeric': 0.15680166147455868, 'fraction_numerical': 0.012876427829698858, 'mean_word_length': 4.387024608501118, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 16, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3966457', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1563, 'n_words': 430}