This commit is contained in:
赵鑫 2022-09-05 14:25:18 +08:00
parent 47f2313347
commit a3c0a9c503

View File

@ -105,12 +105,16 @@ io.on('connection', (client) => {
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
break
case 'turnLeft':
sensehat.led.setRotation(((sensehat.led.rotation - 90) + 360) % 360)
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
var r = ((Number(sensehat.led.rotation) - 90) + 360) % 360
sensehat.led.rotation = r
sensehat.led.setRotation()
// io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
break
case 'turnRight':
sensehat.led.setRotation((sensehat.led.rotation + 90) % 360)
io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
var r = (Number(sensehat.led.rotation) + 90) % 360
sensehat.led.rotation = r
sensehat.led.setRotation(r)
// io.emit('action', { action: 'setPixels', pixels: sensehat.led.pixels })
break
// case 'on':
// sense.setPixel(Number(x), Number(y), color_blue)