This commit is contained in:
赵鑫 2022-09-05 09:06:25 +08:00
parent 1304a904ae
commit cba7264af5

View File

@ -1,15 +1,14 @@
require('dotenv').config() require('dotenv').config()
// const socketio = require('socket.io')
const sense = require('sense-hat-led').sync
const app = require('express')()
app.get('/', (req, res) => res.sendStatus(200))
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000
const host = process.env.HOST || 'localhost' const host = process.env.HOST || 'localhost'
const express = require('express')
const socketio = require('socket.io')
const sense = require('sense-hat-led').sync
const app = express()
app.get('/', (req, res) => res.sendStatus(200))
const server = app.listen(port, host, () => { const server = app.listen(port, host, () => {
console.log(`rpi sense hat server is running at http://${host}:${port}`) console.log(`rpi sense hat server is running at http://${host}:${port}`)
}) })
const io = socketio(server, { cors: { origin: '*' } }) const io = require('socket.io')(server, { cors: { origin: '*' } })
const R = [255, 0, 0] const R = [255, 0, 0]
const G = [0, 255, 0] const G = [0, 255, 0]