1 Star 1 Fork 0

jeremy / sensorium-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

#sensorium-server sensorium-server is a broker tool based on socket.io and serialport. With this tool, you can connect HTML pages easily to your computer USB serialport and debug your protocol communication with the hardware.

Change log

  • sensorium-server@0.1.1 is based on serialport@6.0.4, this 6.0.4 version has fixed some bugs in windows

  • sensorium-server@0.1.0 is based on serialport@6.0.0

Install

You can install it globally like this as recommendation.

npm install sensorium-server -g

or install locally in your project,

npm install sensorium-server -save-dev

some permission error may be resolved by:

npm config set unsafe-perm true

if you update your node version, probably sensorium-server would not work. You just need to update your ss by npm install sensorium-server -g to rebuild it.

Usage

Firstly, make sure you have initialized your project. Then complete the JavaScript code to set up connections between your pages and the sensorium-server tool just like this:

import io from 'socket.io-client';
let socket = io.connect('http://localhost:8800');

socket.on('sensor2web', function (data) {
    console.log(JSON.parse(data));
});

let buf = [0xf3, 0x0a, 0x55, 0xf4];
socket.emit('web2sensor', { buf: JSON.stringify(buf) });

Secondly, open your command line and in any file directories(because it can run globally)type in

sensorium-server

or just simply like this,

ss

** You may need connect a USB line to your computer before, or it would fail to start*

when comes the start-up log, it says the connection has been established!

>>> ss
Starting up sensorium-server, serving on port 8800
  http://127.0.0.1:8800
Hit CTRL + C to stop the server

Defualtly ss connets to the [0] ports as follows:
[ 0 ] : /dev/tty.wchusbserial1420  √
[ 1 ] : /dev/tty.Makeblock-ELETSPP
[ 2 ] : /dev/tty.Bluetooth-Incoming-Port
If there comes an error or no response, you should try to connect to the other port:
 ss -s 1
The MIT License (MIT) Copyright (c) 2017 jeremy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

http server for connecting web to serialport, like a http proxy 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/jeremy_yang/sensorium-server.git
git@gitee.com:jeremy_yang/sensorium-server.git
jeremy_yang
sensorium-server
sensorium-server
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891