This commit is contained in:
赵鑫 2022-09-05 10:44:24 +08:00
parent fce603b392
commit 5466b7db70

View File

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