.PS cct_init # resistor. log_init # Usual defs... qrt=dimen_/4; hlf=dimen_/2; dim=dimen_; # Basic RS Flip Flop: G1:NOR_gate line from G1.In1 left_ 6*L_unit; R:Here line from G1.Out right_ 6*L_unit; " $Q$" ljust_ line from G1.In2 left_ 3*L_unit then down_ 3*L_unit J1:Here move to G1.center then down_ 12*L_unit; right_ G2:NOR_gate with .center at Here line from G2.In2 left_ 6*L_unit; S:Here line from G2.Out right_ 6*L_unit; " $\overline{Q}$" ljust_ line from G2.In1 left 3*L_unit then up_ 3*L_unit J2:Here move to G1.Out then right_ 3*L_unit line from J2 to (Here,J1) then to Here; dot move to G2.Out then right_ 3*L_unit line from J1 to (Here,J2) then to Here; dot # Rest of debounce stuff: Mid:move to G1.center+(0,(G2.center.y-G1.center.y)/2) move to R {resistor(down_); ground(,T)} dot; line left_ 6*L_unit move to (Here,Mid)-(3*L_unit,0) # SPDT Switch: Com:dot line up_ 2*L_unit right_ 4*L_unit move left_ L_unit NC:dot move down_ 4*L_unit NO:dot line from NC to (NC,R) line from NO to (NO,S); line to S; dot resistor(down_); ground(,T); line from Com left_ 4*L_unit then up_ 3*L_unit; dot move up_ 2*L_unit; right_; "5V" move to G2.center then down_ 4*L_unit "\tiny RSDebounce" ljust_ .PE