lwcassid / SPDT Switch

Files

Pins

Symbol

PCB

Open in Flux
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
31
const terminalAid = "1d05b6b4-dd93-fc4b-719a-9ee164b9f6d0"; //A
const terminalBid = "44654286-4a28-ee48-fe11-5b858a5f61c4"; //B
const terminalCommonid = "e252cd8c-0591-e3d4-c438-84662006ed5c"; //Common
const mySwitch = flux.controls.find(control => control.name === "Switch Position");
// Set initial switch position
if (mySwitch !== undefined) {
    if (mySwitch.value) {
        flux.currentSymbol = "A";
        flux.simulationModel = {
            type: "SPDTSwitch", 
            position: 1,
            map_input_one_to_terminal_uid: terminalBid,
            map_input_two_to_terminal_uid: terminalAid,
            map_output_to_terminal_uid: terminalCommonid,
        };
    } else {
        flux.currentSymbol = "B";
        flux.simulationModel = {
            type: "SPDTSwitch", 
            position: 2,
            map_input_one_to_terminal_uid: terminalBid,
            map_input_two_to_terminal_uid: terminalAid,
            map_output_to_terminal_uid: terminalCommonid,
        };
    }
};
// Set switch position based on control updates
flux.on("inputChange", (e: InputControlChangeEvent) => {
Enter to Rename, Shift+Enter to Preview

Reviews