blob: 86d1415b804bea716f01ab16da3f258fa55ba119 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/ruby
require "./lace"
def r(size, suffix="ohm")
comp("R", "0805", "resistor", "#{Lace::e12(size)}#{suffix}")
end
def c(size, suffix="nF")
comp("C", "0805", "capacitor", "#{Lace::e12(size)}#{suffix}")
end
def led(color="red")
comp("D", "0805", "LED", "1.5V 10mA #{color}")
end
nl = Lace::Netlist.new do
vcc = net("vcc")
gnd = net("gnd")
vcc - r((5 - 1.5)/0.010) - led - gnd
vcc - c(100) - gnd
end
nl.kicad
$stdout.write("\n")
nl.summary
$stdout.write("\nBOM:\n")
bom = nl.bom
bom.keys.sort.each do | item |
$stdout.write(" #{bom[item]}\t#{item}\n")
end
|