JsBridge 开灯关灯

开灯

function su_kaideng(name, cmds) {
    JsBridge.require("SerialPort").open({
            name: "Com1", //看具体设备
            stop_bits: 1,
            baud_rate: 9600,
            data_bits: 8,
            parity: "none", //odd even
        },
        function (ret) {
            JsBridge.require("SerialPort").write({
                id: ret.id,
                data: '55 00 05 01 01 FF FF 6D A9 AA',
                data_type: "hex",
            });
        }
    );
};

  

  关灯

function su_guandeng(name, cmds) {
  JsBridge.require("SerialPort").open({
          name: "Com1",
          stop_bits: 1,
          baud_rate: 9600,
          data_bits: 8,
          parity: "none", //odd even
      },
      function (ret) {
          JsBridge.require("SerialPort").write({
              id: ret.id,
              data: '55 00 05 01 01 00 00 6D A9 AA',
              data_type: "hex",
          });
      }
  );
};

  

posted @ 2020-10-09 09:50  野鹤亦闲云  阅读(112)  评论(0编辑  收藏  举报