Node.js 串口读写包 node-serialport
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/voodootikigod/node-serialport
- 软件文档: https://github.com/voodootikigod/node-serialport
软件介绍
node-serialport 是一个 Node.js 的包,用来对串口数据进行读写操作。
基本示例代码:
var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/tty-usbserial1", {
baudrate: 57600
}, false); // this is the openImmediately flag [default is true]
serialPort.open(function (error) {
if ( error ) {
console.log('failed to open: '+error);
} else {
console.log('open');
serialPort.on('data', function(data) {
console.log('data received: ' + data);
});
serialPort.write("ls\n", function(err, results) {
console.log('err ' + err);
console.log('results ' + results);
});
}
});罗列所有串口:
var serialPort = require("serialport");
serialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
console.log(port.pnpId);
console.log(port.manufacturer);
});
});串口配置:
baudRatedataBitsstopBitsparityrtsctsxonxoffxanyflowControlbufferSizeparserencodingdataCallbackdisconnectedCallbackplatformOptions- sets platform specific options, see below.
目前已有很多项目在使用这个包进行串口处理:
Johnny-Five - Firmata based Arduino Framework.
Cylon.js - JavaScript Robotics, By Your Command.
node-l8smartlight (source) A node library to control the L8 Smartlight via Bluetooth or USB port
firmata Talk natively to Arduino using the firmata protocol.
tmpad source - a DIY midi pad using infrared, arduino, and nodejs. Video
duino - A higher level framework for working with Arduinos in node.js.
Arduino Drinking Game Extravaganza - AKA "The Russian" a hexidecimal drinking game for geeks by Uxebu presented at JSConf EU 2011.
Arduino controlling popcorn.js - Controlling a popcorn.js video with an Arduino kit.
Robotic JavaScript - The first live presentation of the node-serialport code set as presented at JSConf EU 2010.
devicestack - This module helps you to represent a device and its protocol.
reflecta A communication protocol that combines Arduino Libraries and NodeJS into an integrated system.
rc4pt-node - Control Popcorntime with an Infrared receiver and Arduino.
Web API的设计与开发
[日] 水野贵明 / 盛荣 / 人民邮电出版社 / 2017-6 / 52.00元
本书结合丰富的实例,详细讲解了Web API的设计、开发与运维相关的知识。第1章介绍Web API的概要;第2章详述端点的设计与请求的形式;第3章介绍响应数据的设计;第4章介绍如何充分利用HTTP协议规范;第5章介绍如何开发方便更改设计的Web API;第6章介绍如何开发牢固的Web API。 本书不仅适合在工作中需要设计、开发或修改Web API的技术人员阅读,对想了解技术细节的产品经理、运维人......一起来看看 《Web API的设计与开发》 这本书的介绍吧!
Base64 编码/解码
Base64 编码/解码
MD5 加密
MD5 加密工具
