39 lines
912 B
JavaScript
39 lines
912 B
JavaScript
const { Client } = require("openrgb-sdk")
|
|
const flags = require("./config/flags.js")
|
|
|
|
|
|
const ms = 1000;
|
|
let client;
|
|
|
|
async function start () {
|
|
client = new Client("Example", 6742, "localhost")
|
|
|
|
await client.connect()
|
|
const amount = await client.getControllerCount()
|
|
console.log(amount)
|
|
let deviceList = []
|
|
for (let deviceId = 0; deviceId < amount; deviceId++) {
|
|
deviceList.push(await client.getControllerData(deviceId))
|
|
}
|
|
console.log(deviceList)
|
|
loop()
|
|
}
|
|
|
|
|
|
async function loop(i=0){
|
|
await client.updateLeds(0, flags[flags.animate[i]])
|
|
await client.updateLeds(1, flags[flags.animate[i]])
|
|
await client.updateLeds(2, flags[flags.animate[i]])
|
|
await client.updateLeds(3, flags[flags.animate[i]])
|
|
//await client.disconnect()
|
|
i++;
|
|
if(i>=flags.animate.length){
|
|
i=0
|
|
}
|
|
setTimeout(_ => loop(i), ms)
|
|
}
|
|
console.log(flags[flags.animate[1]])
|
|
start()
|
|
|
|
|