tscircuit/blinking-led-circuit

A simple blinking led circuit

Usage: To import and use the blinking LED circuit package: 1. Import the circuit component: ```tsx import { MyCircuit } from "@tsci/tscircuit.blinking-led-circuit" ``` 2. Use the component in a React component: ```tsx export default () => ( <MyCircuit /> ) ``` The `MyCircuit` component represents a complete blinking LED circuit with batteries, resistors, capacitors, an NE555 timer, LED, and switch, which can be directly embedded in a tscircuit board layout.

Version
0.0.1
License
unset
Stars
0

dist/index.cjs

'use strict';

var footprints = require('@tscircuit/footprints');

const Trace = ({
  from,
  to,
  thickness,
  pcb_route_hints,
  schematic_route_hints
}) => /*#__PURE__*/React.createElement("trace", {
  from: from,
  to: to,
  thickness: thickness ?? "0.2mm",
  pcb_route_hints: pcb_route_hints,
  schematic_route_hints: schematic_route_hints
});
const Battery = ({
  name,
  center,
  pcb_x,
  pcb_y
}) => /*#__PURE__*/React.createElement("component", {
  center: center,
  name: name,
  pcb_x: pcb_x,
  pcb_y: pcb_y,
  supplier_part_numbers: {
    jlcpcb: ["C70377"]
  }
}, /*#__PURE__*/React.createElement("port", {
  name: "neg",
  x: "-0.5mm",
  y: "0mm",
  dir: "left"
}), /*#__PURE__*/React.createElement("port", {
  name: "pos",
  x: "0.5mm",
  y: "0mm",
  dir: "right"
}), /*#__PURE__*/React.createElement("schematicbox", {
  width: "2mm",
  height: "0.5mm",
  x: 0,
  y: 0
}), /*#__PURE__*/React.createElement("schematictext", {
  text: name,
  position: {
    x: 0,
    y: 0
  }
}), /*#__PURE__*/React.createElement("schematictext", {
  text: "-",
  position: {
    x: -0.25,
    y: -0.125
  }
}), /*#__PURE__*/React.createElement("schematictext", {
  text: "+",
  position: {
    x: 0.25,
    y: -0.125
  }
}), /*#__PURE__*/React.createElement("smtpad", {
  shape: "rect",
  layer: "top",
  x: 0,
  y: -26 / 2 - 3 / 2,
  width: "4.2mm",
  height: "3mm",
  port_hints: ["pos"]
}), /*#__PURE__*/React.createElement("smtpad", {
  shape: "rect",
  layer: "top",
  x: 0,
  y: 26 / 2 + 3 / 2,
  width: "4.2mm",
  height: "3mm",
  port_hints: ["neg"]
}));
const MyCircuit = () => /*#__PURE__*/React.createElement("board", {
  width: "100mm",
  height: "120mm",
  center_x: 0,
  center_y: 0
}, /*#__PURE__*/React.createElement("resistor", {
  resistance: "100k",
  name: "R1",
  footprint: "1210",
  center: [-3, 0.5],
  pcb_x: 10,
  pcb_y: 5,
  supplier_part_numbers: {
    jlcpcb: ["C620660"]
  },
  rotation: "90deg"
}), /*#__PURE__*/React.createElement("resistor", {
  resistance: "1k",
  name: "R2",
  pcb_x: 10,
  pcb_y: -5,
  supplier_part_numbers: {
    jlcpcb: ["C52444"]
  },
  footprint: "1210",
  center: [-3, -1],
  rotation: "90deg"
}), /*#__PURE__*/React.createElement("resistor", {
  resistance: "220",
  name: "R3",
  pcb_x: 30,
  pcb_y: 5,
  supplier_part_numbers: {
    jlcpcb: ["C3000591"]
  },
  footprint: "1210",
  rotation: "90deg",
  center: [3, 2]
}), /*#__PURE__*/React.createElement("capacitor", {
  capacitance: "10uF",
  name: "C1",
  pcb_x: 10,
  pcb_y: 10,
  footprint: "1210",
  supplier_part_numbers: {
    jlcpcb: ["C92834"]
  },
  center: [-3, 2],
  rotation: "90deg"
}), /*#__PURE__*/React.createElement("diode", {
  name: "LED",
  footprint: "1210",
  supplier_part_numbers: {
    jlcpcb: ["C965841"]
  },
  center: [3, 0.5],
  rotation: "90deg",
  pcb_x: 30,
  pcb_y: 0
}), /*#__PURE__*/React.createElement("bug", {
  name: "U1",
  pcb_x: 20,
  pcb_y: 0,
  supplier_part_numbers: {
    jlcpcb: ["C596355"]
  },
  footprint: /*#__PURE__*/React.createElement(footprints.SmallOutline, {
    pad_count: 8,
    pad_length: 0.5,
    pad_width: 1,
    pad_pitch: 1.27,
    row_spacing: 5.5
  }),
  center: [0, 0],
  port_arrangement: {
    left_side: {
      pins: [6, 7, 2]
    },
    right_side: {
      pins: [8, 4, 3, 5, 1]
    }
  },
  port_labels: {
    // NE555 port labels
    1: "GND",
    2: "TRIG",
    3: "OUT",
    4: "RESET",
    5: "CTRL",
    6: "THRES",
    7: "DISCH",
    8: "VCC"
  }
}), /*#__PURE__*/React.createElement(Battery, {
  name: "B1",
  center: [-1.5, -3],
  pcb_x: -30,
  pcb_y: 30
}), /*#__PURE__*/React.createElement(Battery, {
  name: "B2",
  center: [1.5, -3],
  pcb_x: -30,
  pcb_y: -30
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".B1 > .pos",
  thickness: "1mm",
  to: ".B2 > .neg"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .DISCH",
  to: ".R2 > .right"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".R2 > .right",
  to: ".R1 > .left"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".R1 > .right",
  to: ".C1 > .left"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .THRES",
  to: ".C1 > .left"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .TRIG",
  to: ".C1 > .left"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".C1 > .right",
  to: ".B1 > .neg",
  thickness: "0.6mm",
  schematic_route_hints: [{
    x: -4,
    y: 3
  }, {
    x: -4,
    y: -3
  }]
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .GND",
  to: ".C1 > .right",
  pcb_route_hints: [{
    x: 14,
    y: -2,
    via: true
  }, {
    x: 14,
    y: 12,
    via: true
  }]
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".R3 > .right",
  to: ".C1 > .right"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".LED > .right",
  to: ".R3 > .left"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .OUT",
  to: ".LED > .left",
  pcb_route_hints: [{
    x: 19,
    y: 1,
    via: true
  }, {
    x: 26,
    y: 0,
    via: true
  }]
}), /*#__PURE__*/React.createElement("bug", {
  name: "S1",
  pcb_x: 0,
  pcb_y: -20,
  supplier_part_numbers: {
    jlcpcb: ["C2906280"]
  },
  footprint: /*#__PURE__*/React.createElement(footprints.SmallOutline, {
    pad_count: 6,
    pad_length: 1,
    pad_width: 2,
    pad_pitch: 2.5,
    row_spacing: 4.5
  }),
  center: [4, -1.5],
  port_arrangement: {
    left_size: 3,
    right_size: 3
  },
  port_labels: {
    1: "1",
    2: "2",
    3: "3",
    4: "4",
    5: "5",
    6: "6"
  }
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .RESET",
  to: ".S1 > .3",
  pcb_route_hints: [{
    x: 16,
    y: 3,
    via: true
  }, {
    x: 16,
    y: -6,
    via: true
  }]
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".R2 > .left",
  to: ".S1 > .3"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".U1 > .VCC",
  to: ".S1 > .3"
}), /*#__PURE__*/React.createElement(Trace, {
  from: ".B2 > .pos",
  to: ".S1 > .2",
  thickness: "0.6mm"
}));

exports.Battery = Battery;
exports.MyCircuit = MyCircuit;
exports.Trace = Trace;