This commit is contained in:
赵鑫 2022-09-05 13:46:43 +08:00
parent 0c9a1eef7a
commit 7cc61365be

View File

@ -54,7 +54,6 @@ const sensehat = {
}
sensehat.led.clear()
sensehat.led.loadImage('images/heart.png')
sensehat.led.setPixel(0, 0, [255, 255, 255])
// socketio 服务
const io = require('socket.io')(server, { cors: { origin: '*' } })
@ -78,8 +77,8 @@ io.on('connection', (client) => {
break
case 'setPixel':
if (color == undefined) color = [255, 255, 255]
// sensehat.led.setPixel(x, y, 255, 255, 255)
// io.emit('action', { action: 'setPixel', x, y, color: [255, 255, 255] })
sensehat.led.setPixel(Number(x), Number(y), color)
io.emit('action', { action: 'setPixel', x, y, color })
break
// case 'getPixel':
// color = sensehat.led.getPixel(x, y)