-
Notifications
You must be signed in to change notification settings - Fork 0
/
ledToggle.js
30 lines (26 loc) · 1007 Bytes
/
ledToggle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Funzione per gestire l'accensione e lo spegnimento della levetta e del LED
function toggleSwitch() {
const switchElement = document.getElementById('editMode');
const led = document.getElementById('led');
const lampElements = document.querySelectorAll('.lamp, .button');
switchElement.classList.toggle('off');
led.classList.toggle('off');
editModeActive = !editModeActive; // Inverti lo stato di editModeActive
deactivateAllPads();
if (!editModeActive) {
lampElements.forEach(element => {
element.style.display = 'none';
});
} else {
lampElements.forEach(element => {
element.style.display = 'flex';
});
}
}
function autoSwitch() {
const switchElement = document.getElementById('autoMode');
const led = document.getElementById('ledAutoMode');
switchElement.classList.toggle('off');
led.classList.toggle('off');
autoModeActive = !autoModeActive;
}