|
|
@ -3,7 +3,10 @@ const express = require('express')
|
|
|
|
const bodyParser = require('body-parser')
|
|
|
|
const bodyParser = require('body-parser')
|
|
|
|
const app = express()
|
|
|
|
const app = express()
|
|
|
|
const movement = 1000;
|
|
|
|
const movement = 1000;
|
|
|
|
|
|
|
|
import hpgl from "./hpgl.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(hpgl());
|
|
|
|
// Create a port
|
|
|
|
// Create a port
|
|
|
|
const port = new SerialPort({
|
|
|
|
const port = new SerialPort({
|
|
|
|
path: '/dev/ttyUSB0',
|
|
|
|
path: '/dev/ttyUSB0',
|
|
|
@ -14,6 +17,7 @@ const port = new SerialPort({
|
|
|
|
|
|
|
|
|
|
|
|
const toPlotter = (message) => {
|
|
|
|
const toPlotter = (message) => {
|
|
|
|
console.log("i will write to plotter ", message);
|
|
|
|
console.log("i will write to plotter ", message);
|
|
|
|
|
|
|
|
|
|
|
|
port.write(message, function (err) {
|
|
|
|
port.write(message, function (err) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return console.log('Error on write: ', err.message)
|
|
|
|
return console.log('Error on write: ', err.message)
|
|
|
|