This commit is contained in:
赵鑫 2022-09-05 10:35:26 +08:00
parent 6d9f8f36c2
commit af6f38b2da

View File

@ -52,11 +52,14 @@ sensehat.led.loadImage('images/heart.png')
// socketio 服务
const io = require('socket.io')(server, { cors: { origin: '*' } })
io.on('connection', (client) => {
client.on('operation', ({ action, x, y, color, r, g, b, pixels }) => {
client.on('operation', ({ action, x, y, color, pixels }) => {
switch (action) {
case 'clear':
sensehat.led.clear()
break
case 'setPixel':
sensehat.led.setPixel(Number(x), Number(y), color)
break
// case 'on':
// sense.setPixel(Number(x), Number(y), color_blue)
// leds[y][x] = 1