tscircuit/autorouting-dataset-01

This code manages the hardware and electronic components for circuit design and PCB layout, defining components like resistors, capacitors, transistors, connectors, and footprints, and providing tools for component placement, PCB topology, and electrical connections.

Version
1.0.102
License
unset
Stars
4

lib/circuit/circuit007.tsx

PCBPCB preview for lib/circuit/circuit007.tsx
SchematicSchematic preview for lib/circuit/circuit007.tsx
import { shouldAutorouterRun } from "lib/shouldAutorouterRun"
import { sel } from "tscircuit"

/**
 * Button input with pull-up and LED output.
 *
 * What the board does:
 * - Provides a pull-up resistor to VCC for a momentary button input.
 * - Exposes VCC/BTN/GND/LED on a 1x4 header and BTN/GND on a 1x2 header.
 * - Lights an LED when the button signal is active.
 */
export default () => (
  <board
    routingDisabled={!shouldAutorouterRun()}
    width="20.32mm"
    height="20.32mm"
  >
    <pinheader
      name="J1"
      pinCount={4}
      pitch="2.54mm"
      pcbX={-6.35}
      pcbY={0}
      pcbRotation={90}
      connections={{
        pin1: sel.net().VCC,
        pin2: sel.net().BTN,
        pin3: sel.net.GND,
        pin4: sel.net().LED,
      }}
    />

    <resistor
      name="R1"
      resistance="10k"
      footprint="0603"
      pcbX={0}
      pcbY={6.35}
      connections={{
        pin1: sel.net().VCC,
        pin2: sel.net().BTN,
      }}
    />

    <pinheader
      name="J2"
      pinCount={2}
      pitch="2.54mm"
      pcbX={0}
      pcbY={0}
      pcbRotation={90}
      connections={{
        pin1: sel.net().BTN,
        pin2: sel.net.GND,
      }}
    />

    <resistor
      name="R2"
      resistance="1k"
      footprint="0603"
      pcbX={6.35}
      pcbY={-2.54}
      connections={{
        pin1: sel.net().LED,
        pin2: sel.D1.pin1,
      }}
    />

    <led
      name="D1"
      color="red"
      footprint="0603"
      pcbX={8.25}
      pcbY={-2.54}
      connections={{
        pin1: sel.R2.pin2,
        pin2: sel.net.GND,
      }}
    />
  </board>
)