I am creating a circuit diagram using LaTeX and Circuitikz, but I'm having trouble aligning two LEDs vertically. I want both LEDs to be at the same x-position to ensure they are vertically aligned.
My Output:
In the output, the green and red LEDs are not vertically aligned as shown in the screenshot below:
My Desired Output:
I would like the green and red LEDs to be vertically aligned, as shown in the desired output below:
My Code:
\documentclass[border=0cm]{standalone}
\usepackage[emptydiode]{circuitikz} % For an empty diode symbol
\usetikzlibrary{ext.paths.ortho}
\pgfqkeys{/mm}{myLabel/.initial=DefaultLabel}
\pgfdeclareshape{ESPuC}{
% define saved anchor
% ----------------------------------------
\anchor{center}{\pgfpointorigin}
% define Connectors relative to the center
% ----------------------------------------
\savedanchor\myICpinA{\pgfpoint{-40}{91}}
\savedanchor\myICpinB{\pgfpoint{-40}{78}}
\savedanchor\myICpinC{\pgfpoint{-40}{65}}
\savedanchor\myICpinD{\pgfpoint{-40}{52}}
\savedanchor\myICpinE{\pgfpoint{-40}{39}}
\savedanchor\myICpinF{\pgfpoint{-40}{26}}
\savedanchor\myICpinG{\pgfpoint{-40}{13}}
\savedanchor\myICpinH{\pgfpoint{-40}{0}}
\savedanchor\myICpinI{\pgfpoint{-40}{-13}}
\savedanchor\myICpinJ{\pgfpoint{-40}{-26}}
\savedanchor\myICpinK{\pgfpoint{-40}{-39}}
\savedanchor\myICpinL{\pgfpoint{-40}{-52}}
\savedanchor\myICpinM{\pgfpoint{-40}{-65}}
\savedanchor\myICpinN{\pgfpoint{-40}{-78}}
\savedanchor\myICpinO{\pgfpoint{-40}{-91}}
\savedanchor\myICpinAA{\pgfpoint{40}{91}}
\savedanchor\myICpinBB{\pgfpoint{40}{78}}
\savedanchor\myICpinCC{\pgfpoint{40}{65}}
\savedanchor\myICpinDD{\pgfpoint{40}{52}}
\savedanchor\myICpinEE{\pgfpoint{40}{39}}
\savedanchor\myICpinFF{\pgfpoint{40}{26}}
\savedanchor\myICpinGG{\pgfpoint{40}{13}}
\savedanchor\myICpinHH{\pgfpoint{40}{0}}
\savedanchor\myICpinII{\pgfpoint{40}{-13}}
\savedanchor\myICpinJJ{\pgfpoint{40}{-26}}
\savedanchor\myICpinKK{\pgfpoint{40}{-39}}
\savedanchor\myICpinLL{\pgfpoint{40}{-52}}
\savedanchor\myICpinMM{\pgfpoint{40}{-65}}
\savedanchor\myICpinNN{\pgfpoint{40}{-78}}
\savedanchor\myICpinOO{\pgfpoint{40}{-91}}
\anchor{PinA}{\myICpinA}
\anchor{PinB}{\myICpinB}
\anchor{PinC}{\myICpinC}
\anchor{PinD}{\myICpinD}
\anchor{PinE}{\myICpinE}
\anchor{PinF}{\myICpinF}
\anchor{PinG}{\myICpinG}
\anchor{PinH}{\myICpinH}
\anchor{PinI}{\myICpinI}
\anchor{PinJ}{\myICpinJ}
\anchor{PinK}{\myICpinK}
\anchor{PinL}{\myICpinL}
\anchor{PinM}{\myICpinM}
\anchor{PinN}{\myICpinN}
\anchor{PinO}{\myICpinO}
\anchor{PinAA}{\myICpinAA}
\anchor{PinBB}{\myICpinBB}
\anchor{PinCC}{\myICpinCC}
\anchor{PinDD}{\myICpinDD}
\anchor{PinEE}{\myICpinEE}
\anchor{PinFF}{\myICpinFF}
\anchor{PinGG}{\myICpinGG}
\anchor{PinHH}{\myICpinHH}
\anchor{PinII}{\myICpinII}
\anchor{PinJJ}{\myICpinJJ}
\anchor{PinKK}{\myICpinKK}
\anchor{PinLL}{\myICpinLL}
\anchor{PinMM}{\myICpinMM}
\anchor{PinNN}{\myICpinNN}
\anchor{PinOO}{\myICpinOO}
\foregroundpath{
\pgfpathrectanglecorners{\pgfpoint{-40}{-104}}{\pgfpoint{40}{104}}
\pgfusepath{draw}
\pgftext[left, at={\myICpinA}]{ \texttt{A0}}
\pgftext[left, at={\myICpinB}]{ \texttt{G}}
\pgftext[left, at={\myICpinC}]{ \texttt{VV}}
\pgftext[left, at={\myICpinD}]{ \texttt{S3}}
\pgftext[left, at={\myICpinE}]{ \texttt{S2}}
\pgftext[left, at={\myICpinF}]{ \texttt{S1}}
\pgftext[left, at={\myICpinG}]{ \texttt{SC}}
\pgftext[left, at={\myICpinH}]{ \texttt{S0}}
\pgftext[left, at={\myICpinI}]{ \texttt{SK}}
\pgftext[left, at={\myICpinJ}]{ \texttt{G}}
\pgftext[left, at={\myICpinK}]{ \texttt{3V}}
\pgftext[left, at={\myICpinL}]{ \texttt{EN}}
\pgftext[left, at={\myICpinM}]{ \texttt{RST}}
\pgftext[left, at={\myICpinN}]{ \texttt{G}}
\pgftext[left, at={\myICpinO}]{ \texttt{VIN}}
\pgftext[right, at={\myICpinAA}]{\texttt{D0} }
\pgftext[right, at={\myICpinBB}]{\texttt{D1} }
\pgftext[right, at={\myICpinCC}]{\texttt{D2} }
\pgftext[right, at={\myICpinDD}]{\texttt{D3} }
\pgftext[right, at={\myICpinEE}]{\texttt{D4} }
\pgftext[right, at={\myICpinFF}]{\texttt{3V} }
\pgftext[right, at={\myICpinGG}]{\texttt{G} }
\pgftext[right, at={\myICpinHH}]{\texttt{D5} }
\pgftext[right, at={\myICpinII}]{\texttt{D6} }
\pgftext[right, at={\myICpinJJ}]{\texttt{D7} }
\pgftext[right, at={\myICpinKK}]{\texttt{D8} }
\pgftext[right, at={\myICpinLL}]{\texttt{RX} }
\pgftext[right, at={\myICpinMM}]{\texttt{TX} }
\pgftext[right, at={\myICpinNN}]{\texttt{G} }
\pgftext[right, at={\myICpinOO}]{\texttt{3V} }
% my static label
\pgftext[center, at={\pgfpoint{0}{109}}]{\small\textcolor{black}{\pgfkeysvalueof{/mm/myLabel}}}
}
}
\begin{document}
\ctikzset{bipoles/length=.8cm}
\begin{circuitikz}
\draw (0,0) node[ESPuC, /mm/myLabel=ESP8266] (esp) {};
\draw[blue] (esp.PinNN) -- ++(6,0);
\draw[red] (esp.PinOO) -- ++(6,0);
\draw (esp.PinII) to [R, l=$330\Omega$] ++(2,0) to [fill=red, led, l=LED] ++(2,0)
-- ++(0,-2) coordinate (kathode)
-- (esp.PinNN -| kathode) node[ground, blue, circ]{};
\draw (esp.PinCC) to [R, l=$330\Omega$] ++(2,0) to [fill=green, led, l=LED] ++(3,0)
-- ++(0,-2) coordinate (kathode)
-- (esp.PinNN -| kathode) node[ground, blue, circ]{};
\end{circuitikz}
\end{document}