tinsangbeeping/test_0609_1
This code models a small 10mm x 10mm PCB with a 1kΩ resistor (R1) and a 1000pF capacitor (C1) connected to form a simple RC circuit.
- Version
- 0.0.1
- License
- unset
- Stars
- 0
subcircuits/Switch_deb_led.tsx
export const ports = ["power", "GND"] as const
export function Switch_deb_led(props: { name: string; schX?: number; schY?: number; connections?: Partial<Record<typeof ports[number], string>> }) {
const x = props.schX ?? 0
const y = props.schY ?? 0
return (
<subcircuit name={props.name}>
{/* // editorSchX={192} */}
{/* // editorSchY={76} */}
<resistor
name="R1"
resistance="10k"
footprint="0805"
schX={x + 9.6}
schY={y + 3.8}
schRotation="0deg"
/>
{/* // editorSchX={266} */}
{/* // editorSchY={88} */}
<capacitor
name="C1"
capacitance="100nF"
footprint="0805"
schX={x + 13.3}
schY={y + 4.4}
schRotation="0deg"
/>
{/* // editorSchX={348} */}
{/* // editorSchY={84} */}
<led
name="LED1"
color="red"
footprint="0805"
schX={x + 17.4}
schY={y + 4.2}
schRotation="90deg"
/>
{/* // editorSchX={116} */}
{/* // editorSchY={70} */}
<switch
name="SW1"
type="spst"
footprint="pushbutton"
schX={x + 5.8}
schY={y + 3.5}
schRotation="0deg"
/>
<port
name="power"
schX={x + 1}
schY={y + 3.7}
/>
<port
name="GND"
schX={x + 12.9}
schY={y + 8}
/>
<trace from=".C1 > .pin1" to=".R1 > .pin2" />
<trace from=".C1 > .pin2" to={props.connections?.GND ?? "net.GND"} />
<trace from=".LED1 > .anode" to=".C1 > .pin1" />
<trace from=".LED1 > .cathode" to=".C1 > .pin2" />
<trace from=".SW1 > .pin1" to={props.connections?.power ?? "net.POWER"} />
<trace from=".SW1 > .pin2" to=".R1 > .pin1" />
</subcircuit>
)
}