update
This commit is contained in:
parent
806037fca5
commit
6a6aaf2167
10
server.js
10
server.js
@ -31,10 +31,10 @@ const sensehat = {
|
||||
getPixel(x,y) 返回 [r,g,b] 获取一个点
|
||||
setPixels([[r,g,b]*64])
|
||||
getPixels() -> [[r,g,b]*64]
|
||||
|
||||
flipH(redraw=true) 水平反转
|
||||
flipV(redraw=true) 垂直反转
|
||||
|
||||
|
||||
setRotation(r, redraw=true) 设置旋转,r 初始为 0,r 只能设置为 0/90/180/270
|
||||
getter and setter rotation 默认为 0
|
||||
|
||||
@ -104,6 +104,14 @@ io.on('connection', (client) => {
|
||||
sensehat.led.flipV()
|
||||
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
|
||||
break
|
||||
case 'turnLeft':
|
||||
sensehat.led.rotation = ((sensehat.led.rotation - 90) + 360) % 360
|
||||
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
|
||||
break
|
||||
case 'turnRight':
|
||||
sensehat.led.rotation = (sensehat.led.rotation + 90) % 360
|
||||
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
|
||||
break
|
||||
// case 'on':
|
||||
// sense.setPixel(Number(x), Number(y), color_blue)
|
||||
// leds[y][x] = 1
|
||||
|
Loading…
Reference in New Issue
Block a user