Files
diodeinc__pcb/examples/LEDCircuit/LEDCircuit.zen
Akhil Velagapudi f20ac95f64 [DIO-298] [DIO-299] Add pcb bom command to generate unmatched bom (#66)
* Add structured, unmatched BOM export command

Run using `pcb bom <path/to/zen> -o json`

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Test bom command in CI

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Bump stdlib in examples from v0.2.0 to v0.2.2

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Remove default_multiplier, use struct for group key

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use PhysicalValue to do less string parsing

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add alternatives to group key

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use DynamicFullWidth for the comfy table

Attempts to fit the table within terminal width.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 12:13:20 -07:00

23 lines
754 B
Plaintext

"""
A simple LED circuit with current limiting resistor.
This demonstrates using standard components to create a basic LED driver.
"""
load("@stdlib:v0.2.2/interfaces.zen", "Power", "Ground")
Resistor = Module("@stdlib:v0.2.2/generics/Resistor.zen")
Led = Module("@stdlib:v0.2.2/generics/Led.zen")
# Configuration parameters
r_value = config("r_value", str, default="330ohms", optional=True)
led_color = config("led_color", str, default="red", optional=True)
# IO ports
vcc = io("vcc", Power)
gnd = io("gnd", Ground)
# Internal net for LED anode
led_anode = Net("LED_ANODE")
# Create the LED circuit
Resistor(name="R1", value=r_value, package="0603", P1=vcc.NET, P2=led_anode)
Led(name="D1", color=led_color, package="0603", A=led_anode, K=gnd.NET)