Toggle switch
A maintained two-position lever switch for controls that should stay on or off when you let go.
Modeled lever-tip height: approximately 26.5 mm above the component-side PCB surface in the illustrated position. Allow room for the lever to sweep between both stops and for the retaining hardware.
Usage
Choose Add device → Toggle switch and flip the lever. The card displays On or Off. Leave room in the front panel for the lever to reach both stops.
Protocol
USB contact input. Read the clear-to-send signal (CTS) to get the switch state.
| Operation | Request or signal | Result |
|---|---|---|
| Open with Web Serial | port.open({baudRate: 9600, flowControl: "none"}) | Opens the port for polling. |
| Set DTR low | port.setSignals({dataTerminalReady: false}) | Configures the serial control line. |
| Read with Web Serial | (await port.getSignals()).clearToSend | true = On, false = Off. |
| Read with WebUSB | Vendor IN request to the device: 0x95, value 0x0706, index 0, length 2. | Bit 0 of byte 0: 0 = On, 1 = Off. |
Use either the Web Serial or WebUSB path. The console polls every 10 ms and displays a change after 20 ms of stable readings.
Mounting
The PCB measures 24 × 30 mm, with 4 × Ø2.2 mm clearance holes for M2 screws. The centre-to-centre spacing is 19 × 25 mm. Orient the component side with the J1 USB-C port at the bottom. Measure right and up from the lower-left corner of the PCB in the component-side view. The hole centres are at X = 2.5, 21.5 mm and Y = 2.5, 27.5 mm.