This commit is contained in:
赵鑫 2022-09-05 11:27:18 +08:00
parent ee09e01e66
commit 85cdc3abaf

View File

@ -62,19 +62,22 @@ io.on('connection', (client) => {
case 'clear':
if (color == undefined) color = [0, 0, 0]
sensehat.led.clear(color)
client.emit('action', { action: 'clear', color })
break
case 'flash':
if (color == undefined) color = [255, 255, 255]
sensehat.led.clear(color)
setTimeout(sensehat.led.clear, delay | 200)
client.emit('action', { action: 'clear' })
break
case 'getPixel':
color = sensehat.led.getPixel(x, y)
client.emit('setPixel', { x, y, color })
client.emit('action', { action: 'setPixel', x, y, color })
break
case 'setPixel':
if (color == undefined) color = [255, 255, 255]
sensehat.led.setPixel(x, y, color)
io.emit('action', { action: 'setPixel', x, y, color })
break
// case 'on':
// sense.setPixel(Number(x), Number(y), color_blue)