update
This commit is contained in:
parent
4885029570
commit
34c73dd988
11
server.js
11
server.js
@ -27,6 +27,7 @@ const sensehat = {
|
|||||||
sleep(n) 暂停 n 秒
|
sleep(n) 暂停 n 秒
|
||||||
clear() 清除所有
|
clear() 清除所有
|
||||||
clear(rgb) or clear([r,g,b]) 填充颜色
|
clear(rgb) or clear([r,g,b]) 填充颜色
|
||||||
|
|
||||||
setPixel(x,y,r,g,b) or setPixel(x,y,rgb) 设置一个点
|
setPixel(x,y,r,g,b) or setPixel(x,y,rgb) 设置一个点
|
||||||
getPixel(x,y) 返回 [r,g,b] 获取一个点
|
getPixel(x,y) 返回 [r,g,b] 获取一个点
|
||||||
setPixels([[r,g,b]*64])
|
setPixels([[r,g,b]*64])
|
||||||
@ -74,15 +75,15 @@ io.on('connection', (client) => {
|
|||||||
io.emit('action', { action: 'clear' })
|
io.emit('action', { action: 'clear' })
|
||||||
}, delay | 200)
|
}, delay | 200)
|
||||||
break
|
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 'getPixel':
|
// case 'getPixel':
|
||||||
// color = sensehat.led.getPixel(x, y)
|
// color = sensehat.led.getPixel(x, y)
|
||||||
// client.emit('action', { action: 'setPixel', x, y, color })
|
// client.emit('action', { action: 'setPixel', x, y, color })
|
||||||
// break
|
// 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 'getPixels':
|
case 'getPixels':
|
||||||
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
|
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user