-
Notifications
You must be signed in to change notification settings - Fork 1
/
local-debug-test.js
50 lines (42 loc) · 1.01 KB
/
local-debug-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const HID = require('node-hid')
const devices = HID.devices()
console.log(devices)
const vid = 5824
const pid = 1503
const device = new HID.HID(vid, pid)
const all_on = 0xfe
const all_off = 0xfc
const on = 0xff
const off = 0xfd
const relay_null = 0x00
const relay1 = 0x01
const relay2 = 0x02
const DELAY = 6000
setTimeout(() => {
console.log("off")
device.sendFeatureReport([all_off, relay_null])
}, DELAY)
setTimeout(() => {
console.log("off")
device.sendFeatureReport([all_off, relay_null])
}, DELAY+50)
setTimeout(() => {
console.log("on")
device.sendFeatureReport([all_on, relay_null])
}, DELAY+100)
setTimeout(() => {
console.log("on")
device.sendFeatureReport([all_on, relay_null])
}, DELAY+150)
setTimeout(() => {
console.log("off")
device.sendFeatureReport([all_off, relay_null])
}, DELAY+200)
setTimeout(() => {
console.log("on")
device.sendFeatureReport([all_on, relay_null])
}, DELAY+250)
setTimeout(() => {
console.log("off")
device.sendFeatureReport([all_off, relay_null])
}, DELAY+300)