[Tex/LaTex] draw single pole double throw switch in circuitikz

circuitikz

I am new to circuitikz so this question may be too easy for some of you. I want to draw a single pole double throw switch in circuitikz. It can be done with "spdt". However I don't find any example of using it in the manual. I just don't know how to connect this 3-terminal component with the surrounding ones. Can anyone provide an example? Thanks.

Best Answer

The three anchors you are looking are <name>.in, <name>.out 1, and <name>.out 2. A little example showing a spdt component alone with its main three anchors, and another one showing how to connect some of these components with others; sorry if the examples lack any "real" meaning (I know nothing about circuits):

\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz} \draw
(1,0) node[spdt] (myspdt) {}
(0,0) -- (myspdt.in) 
(myspdt.out 1) -- +(1,0)
(myspdt.out 2) -- +(1,0);
\end{circuitikz}

\vspace{1cm}

\begin{circuitikz} \draw
(2,2) node[spdt] (myspdt1) {}
(2,0) node[spdt] (myspdt2) {}
(0,1) node[spdt] (myspdt3) {}
(5,1) node[and port] (myand) {}
(myspdt3.out 1) -| (myspdt1.in)
(myspdt3.out 2) -| (myspdt2.in)
(myspdt1.out 1) -- (myand.in 1)
(myspdt2.out 2) -- (myand.in 2)
;\end{circuitikz}

\end{document}

enter image description here