diff --git a/server.js b/server.js index daf7e67..cd6f5c2 100644 --- a/server.js +++ b/server.js @@ -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)