This commit is contained in:
赵鑫 2022-09-05 10:37:28 +08:00
parent fbddc5fef7
commit a59169aa7f

View File

@ -142,8 +142,8 @@
const client = io.connect('ws://pi', { path: '/sensehat/socket.io', })
function turnon(led) {
const { x, y } = led.dataset
const action = led.classList.toggle('on') ? 'on' : 'off'
client.emit('operation', { action, x, y })
const color = led.classList.toggle('on') ? [0, 0, 0] : [255, 255, 255]
client.emit('operation', { action: 'setPixel', x, y, color })
}
// client.on('leds', (array) => {
// const leds = document.querySelectorAll('.led')