master
IoTcat 5 years ago
parent c26151988f
commit 1d07c8bf8d
  1. 4
      docs/config.js
  2. 8
      src/node/README.md
  3. 9
      src/node/led.js
  4. 2
      src/node/package.json

@ -18,7 +18,7 @@ docute.init({
title: 'Ecosystem', path: '/ecosystem'
},
{
title: 'Support DPlayer', path: '/support'
title: 'Support wIoT', path: '/support'
},
{
title: 'Languages', type: 'dropdown', items: langs
@ -32,7 +32,7 @@ docute.init({
title: '生态', path: '/zh-Hans/ecosystem'
},
{
title: '支持 DPlayer', path: '/zh-Hans/support'
title: '支持 wIoT', path: '/zh-Hans/support'
},
{
title: '选择语言', type: 'dropdown', items: langs

@ -1,5 +1,6 @@
## wIoT for NodeJS
适用于NodeJS的wIoT服务器控制组件,轻松物联
适用于NodeJS的wIoT服务器控制组件,轻松物联
[**Click Here for English Version~**](https://wiot.eee.dog)
## 先觉条件
- 拥有烧录好wIoT固件的**D1 MINI**单片机
@ -20,6 +21,7 @@
### 依赖安装
在你的项目文件夹下打开命令行,输入以下指令安装wiot:
````shell
$ npm install wiot
````
@ -56,6 +58,7 @@ wiot.begin([MyMCU], ()=>{ // 第一个参数为要等待的单片机对象数组
### 开始执行
在项目文件夹中打开命令行,输入以下指令:
````shell
node app.js
````
@ -129,6 +132,7 @@ var MyMCU = new wiot.client({
#### 事件绑定
`.on(event, handler)`
**client事件列表**
@ -177,6 +181,7 @@ wiot.begin([MCU0, MCU1], ()=>{
```
+ `wiot.loop()`: 循环执行的指令,适合于条件控制语句
```js
MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx", pin: {D4: wiot.OUTPUT}});
MCU1 = new wiot.client({MAC: "xx:xx:xx:xx:xx:ww"});
@ -225,6 +230,7 @@ wiot.register.set(()=>{
+ `wiot.led.set(status, time = 0, isSmooth = false)`: 设置led状态,起始状态,中间状态,最终状态,周期
+ `wiot.led.breath(period)`: 设置一个呼吸灯
+ `wiot.led.clear()`: 重置led
```js
MCU0 = new wiot.client({MAC: "xx:xx:xx:xx:xx:xx", pin: {D4: wiot.OUTPUT}});

@ -0,0 +1,9 @@
var wiot = require('./wiot');
var MyMCU = new wiot.client({MAC: "BC:DD:C2:24:85:9F", pin: {D5: 1, D6: 1, D7: 1, D8: 1}});
var led = wiot.led(MyMCU, wiot.D6);
wiot.begin([MyMCU], ()=>{
led.breath(2000);
});

@ -1,6 +1,6 @@
{
"name": "wiot",
"version": "0.2.5",
"version": "0.2.6",
"description": "An awesome iot system for web developers~",
"main": "wiot.js",
"scripts": {

Loading…
Cancel
Save