From 16daa2723ada0a19528e5a866f20dca577bd3944 Mon Sep 17 00:00:00 2001 From: Theenoro Date: Fri, 10 Mar 2023 14:27:11 +0100 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9Econfig?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 38 ++++++++++++++++++++++++++++++++++++++ config/package.json | 14 ++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 config/index.js create mode 100644 config/package.json diff --git a/config/index.js b/config/index.js new file mode 100644 index 0000000..651c6cf --- /dev/null +++ b/config/index.js @@ -0,0 +1,38 @@ +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() + + diff --git a/config/package.json b/config/package.json new file mode 100644 index 0000000..75ba5a6 --- /dev/null +++ b/config/package.json @@ -0,0 +1,14 @@ +{ + "name": "openrgb_control", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "openrgb-sdk": "^0.5.2" + } +}