These are some of the pictures of the current setup.
There is a REST API server implemented using express.js framework. Here is the code:
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.end('end');
})
app.get('/blue', (req, res) => {
const { spawn } = require('child_process');
const pyProg = spawn('sudo', ['python', 'blue.py']);
})
app.get('/red', (req, res) => {
const { spawn } = require('child_process');
const pyProg = spawn('sudo', ['python', 'red.py']);
})
app.get('/green', (req, res) => {
const { spawn } = require('child_process');
const pyProg = spawn('sudo', ['python', 'green.py']);
// pyProg.on('close', (code) => console.log(code));
})
app.listen(4000, () => console.log('Application listening on port 4000!'))
The python codes (red.py, green.py and blue.py) are modified from the example codes from this GiHub (https://github.com/jgarff/rpi_ws281x ) repo. As for the Snips my-lantern Assistant code, the code is in this repo (https://github.com/wesee/snips-my-lantern-py ).
.