mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
- Base bindings class to extend - Move docs to base binding - Make all bindings classes - Ditch push bindings because it doesn't make anything cleaner
20 lines
495 B
JavaScript
20 lines
495 B
JavaScript
/* eslint-disable require-path-exists/exists */
|
|
'use strict';
|
|
|
|
// Open event example
|
|
const SerialPort = require('serialport');
|
|
const port = new SerialPort('/dev/tty-usbserial1');
|
|
|
|
port.on('open', () => {
|
|
console.log('Port Opened');
|
|
});
|
|
|
|
port.write('main screen turn on', (err) => {
|
|
if (err) { return console.log('Error: ', err.message) }
|
|
console.log('message written');
|
|
});
|
|
|
|
port.on('data', (data) => {
|
|
/* get a buffer of data from the serial port */
|
|
console.log(data.toString());
|
|
});
|