diff --git a/bin/core/core.a b/bin/core/core.a index d075e89..ac8b058 100644 Binary files a/bin/core/core.a and b/bin/core/core.a differ diff --git a/node/README.md b/node/README.md index f39138c..337db37 100644 --- a/node/README.md +++ b/node/README.md @@ -143,11 +143,11 @@ MCU1 = new wiot.client({MAC: "xx:xx:xx:xx:xx:ww"}); // 以下代码将实现: 当MCU0的D5接收到HIGH,MCU1的D4将会输出HIGH // 当MCU0的D5接收到LOW, MCU1的D4将会输出LOW // 本函数接受两个参数: 第一个是MCU对象数组, 第二个是参数为MCU对象数组的函数 -wiot.loop([MCU0, MCU1], (mcu) => { - if(mcu[1].read(wiot.D5) == wiot.HIGH){ - mcu[0].write(wiot.D4, wiot.HIGH); +wiot.loop([MCU0, MCU1], () => { + if(MCU1.read(wiot.D5) == wiot.HIGH){ + MCU0.write(wiot.D4, wiot.HIGH); }else{ - mcu[0].write(wiot.D4, wiot.LOW); + MCU0.write(wiot.D4, wiot.LOW); } }); diff --git a/node/app.js b/node/app.js index 831c3b7..897fc1a 100644 --- a/node/app.js +++ b/node/app.js @@ -1,5 +1,5 @@ var wiot = require('./wiot'); -MyMCU = new wiot.client({MAC: "3C:71:BF:3A:F6:CF", pin: {D4: wiot.OUTPUT},debug: 0}); +MyMCU = new wiot.client({MAC: "B4:E6:2D:6A:26:EE", pin: {D4: wiot.OUTPUT},debug: 0}); //q = new wiot.client({MAC: "3C:71:BF:3A:F6:83", pin: {D3: 1} }); wiot.begin([MyMCU], ()=>{ // 第一个参数为要等待的单片机对象数组,第二个参数为要执行的函数 // 设置计时器,每隔2000毫秒, MyMCU的3号pin口将拉高一次电平 diff --git a/node/package.json b/node/package.json index ac06872..fe8e475 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "wiot", - "version": "0.0.12", + "version": "0.0.13", "description": "An awesome iot system for web developers~", "main": "wiot.js", "scripts": { diff --git a/node/wiot.js b/node/wiot.js index 0e71409..2d8739c 100644 --- a/node/wiot.js +++ b/node/wiot.js @@ -2,7 +2,7 @@ * @Author: IoTcat (https://iotcat.me) * @Date: 2019-05-04 18:59:49 * @Last Modified by: IoTcat - * @Last Modified time: 2019-05-06 15:16:58 + * @Last Modified time: 2019-05-06 22:05:07 */ var wiot_client = function (o_params) { var o = { @@ -508,6 +508,7 @@ var wiot_client = function (o_params) { /* exc functions */ var ini = function () { if (o.hint) console.log('wiot - ' + o.MAC + ': init...'); + if(o.MAC.length != 17) throw "Wrong MAC Format!!!"; getLocalIp(); getMAC(); //ip_scan();