-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpulldown.py
More file actions
45 lines (32 loc) · 1.13 KB
/
Copy pathpulldown.py
File metadata and controls
45 lines (32 loc) · 1.13 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
import schemdraw
import schemdraw.elements as elm
"""
Pull Down Circuit
Similar to pull-up, this circuit is used to ensure that an input pin has a
low logic state when no external signal is applied. It consists of a resistor
connected between the input pin and a negative voltage source or ground (GND).
"""
# Create a new schematic diagram object
with schemdraw.Drawing() as d:
# Add the tag for the output pin
d += elm.Tag().label('Out')
# Add a wire to the left net
d += elm.Line().left()
# Save the position of the net
d.push()
# Add the pull-down resistor
d += elm.Resistor().down().label('R1\n10k')
# Add the ground connection
d += elm.Ground()
# Return to the saved position of the net
d.pop()
# Add the switch that closes the circuit and changes the output to Vcc
d += elm.Switch().up()
# Add a tag to indicate the voltage of this point
d += elm.Line().left().length(d.unit*.7).label('Vcc')
# Add the DC source (battery)
d += elm.BatteryCell().down().label('15v', loc='bottom')
d += elm.Line()
d += elm.Ground()
# Draw the schematic diagram
d.draw()