add rpi library
This commit is contained in:
parent
2ef6f3962b
commit
6b354fed02
7 changed files with 69 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
__pycache__
|
__pycache__
|
||||||
|
node_modules/
|
||||||
|
|
3
config.json
Normal file
3
config.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
8
index.js
8
index.js
|
@ -1,9 +1,13 @@
|
||||||
import * as server from './server.js';
|
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(
|
server.recv(
|
||||||
(res) => {
|
(res) => {
|
||||||
console.log(`callback: ${res}`);
|
lights.parse_pattern(JSON.parse(res));
|
||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
console.log(`error callback: ${res}`);
|
console.log(`error callback: ${res}`);
|
||||||
|
|
7
lights.js
Normal file
7
lights.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import * from 'rpi-ws281x-native'
|
||||||
|
|
||||||
|
const fade_ticks = 10;
|
||||||
|
|
||||||
|
export function parse_pattern(pattern) {
|
||||||
|
console.log(pattern)
|
||||||
|
}
|
|
@ -13,5 +13,8 @@
|
||||||
"url": "git@ssh.gitdab.com:jane/leds"
|
"url": "git@ssh.gitdab.com:jane/leds"
|
||||||
},
|
},
|
||||||
"author": "jane@j4.pm",
|
"author": "jane@j4.pm",
|
||||||
"license": "UNLICENSED"
|
"license": "UNLICENSED",
|
||||||
|
"dependencies": {
|
||||||
|
"rpi-ws281x-native": "^1.0.3"
|
||||||
|
}
|
||||||
}
|
}
|
41
pnpm-lock.yaml
Normal file
41
pnpm-lock.yaml
Normal file
|
@ -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
|
2
run.sh
2
run.sh
|
@ -1,2 +1,2 @@
|
||||||
git pull
|
git pull
|
||||||
python ./leds.py
|
node index.js
|
Loading…
Reference in a new issue