add rpi library

This commit is contained in:
jane 2021-05-25 21:55:56 -04:00
parent 2ef6f3962b
commit 6b354fed02
7 changed files with 69 additions and 10 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
__pycache__
__pycache__
node_modules/

3
config.json Normal file
View File

@ -0,0 +1,3 @@
{
}

View File

@ -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}`);
}
);

7
lights.js Normal file
View File

@ -0,0 +1,7 @@
import * from 'rpi-ws281x-native'
const fade_ticks = 10;
export function parse_pattern(pattern) {
console.log(pattern)
}

View File

@ -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"
}
}

41
pnpm-lock.yaml Normal file
View 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
View File

@ -1,2 +1,2 @@
git pull
python ./leds.py
node index.js