diff --git a/.gitignore b/.gitignore index ed8ebf5..631db64 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -__pycache__ \ No newline at end of file +__pycache__ +node_modules/ diff --git a/config.json b/config.json new file mode 100644 index 0000000..077404a --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/index.js b/index.js index 5f82ab6..211c872 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,15 @@ import * as server from './server.js'; +import * as lights from './lights.js'; + +const cfg = require('./config.json'); + +global.cfg = cfg; -console.log(server) server.recv( - (res) => { - console.log(`callback: ${res}`); - }, - (res) => { - console.log(`error callback: ${res}`); - } + (res) => { + lights.parse_pattern(JSON.parse(res)); + }, + (res) => { + console.log(`error callback: ${res}`); + } ); diff --git a/lights.js b/lights.js new file mode 100644 index 0000000..52389cb --- /dev/null +++ b/lights.js @@ -0,0 +1,7 @@ +import * from 'rpi-ws281x-native' + +const fade_ticks = 10; + +export function parse_pattern(pattern) { + console.log(pattern) +} \ No newline at end of file diff --git a/package.json b/package.json index 2d193ee..dc0441d 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,8 @@ "url": "git@ssh.gitdab.com:jane/leds" }, "author": "jane@j4.pm", - "license": "UNLICENSED" + "license": "UNLICENSED", + "dependencies": { + "rpi-ws281x-native": "^1.0.3" + } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..a4b18ca --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,41 @@ +dependencies: + eris: 0.15.1 +lockfileVersion: 5.2 +packages: + /eris/0.15.1: + dependencies: + ws: 7.4.6 + dev: false + engines: + node: '>=10.4.0' + optionalDependencies: + opusscript: 0.0.8 + tweetnacl: 1.0.3 + resolution: + integrity: sha512-IQ3BPW6OjgFoqjdh+irPOa1jFlkotk+WNu2GQQ7QAQfbzQEPZgn+F+hpOxfMUXPHOZMX4sPKLkVDkMHAssBYhw== + /opusscript/0.0.8: + dev: false + optional: true + resolution: + integrity: sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ== + /tweetnacl/1.0.3: + dev: false + optional: true + resolution: + integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + /ws/7.4.6: + dev: false + engines: + node: '>=8.3.0' + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + resolution: + integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +specifiers: + eris: ^0.15.1 diff --git a/run.sh b/run.sh index 5da169d..d0c7b85 100644 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ git pull -python ./leds.py \ No newline at end of file +node index.js \ No newline at end of file