This commit is contained in:
赵鑫 2022-09-12 15:56:06 +08:00
parent ec69df4c2e
commit abcbb8ee6b

View File

@ -10,6 +10,7 @@ app.get('/', (req, res) => res.sendStatus(200))
// 启动HTTP服务
const port = process.env.PORT || 3000
const host = process.env.HOST || 'localhost'
const server = app.listen(port, host, () => {
console.log(`rpi sense hat server is running on port ${port}`)
})
@ -116,6 +117,7 @@ io.on('connection', (client) => {
sensehat.led.flipV()
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
break
case 'turnLeft':
var heading_angle = (Number(sensehat.led.rotation) + 90) % 360
sensehat.led.rotation = heading_angle