I'm working on an elevator with a few differences from many I've seen:- Buttons inside elevator temporarily lock call buttons
- Call buttons lock elevator buttons when used if not locked
- Keypad on the inside gate of each floor that is timed
- You have 15 seconds to enter the code before the buttons are released
I had it working just like I wanted it earlier, but after I unhooked the testing pieces and moved it to it's proper place, saved, and then was forced to load it. Now it just refuses to auto open the gate when a call button calls it down to a floor unless I hit it twice.
Each call button is on it's own circuit for a few reasons, but I'm also open to suggestions on how to condense parts.
I am using two separate scripts to accomplish this (it doesn't look pretty, but it USED to work)
Inputs:
Btn = Button
Kpd = Keypad
Cls = Constant Chip Number for open gate state
Dst = Constant Chip Number for closed gate state
Flr = Constant Chip Number for floor height
Tmr2 = Timer from Elevator circuit
Outputs:
Elv = 1,0 output
Wld = Weld latch switch (not implemented)
Timer (Not used)
Enbl = 1,0 variable to distinguish differences in call or elevator button
Dabl = 1,0 variable that is only on if timer is at current time and Enbl is on
Code:
N@Door Controller
I@Btn Kpd Opn Cls Dst Flr Lock Tmr2
O@Elv Hyd Wld Timer Enbl Dabl
Btn==1 | Kpd==1 -> Enbl=1;
Dabl = (Enbl==1 & Dst==Flr & Tmr2>=1 ? 1 : Enbl=0)
Elv = (Btn == 1 & Lock == 0 ? 1 : 0)
Wld = (Dabl == 1 & Tmr2 < 16 ? 1 : Enbl=0)
Hyd = (Dabl == 1 & Tmr2 < 14 ? Opn : Cls)
Inputs:
A1 - H1 = Elevator Buttons
A2 - H2 = Call Buttons
EH = Get height value from smoother chip as it goes up
Outputs:
O = Floor height sent to smoother chip
L = Variable sent to call circuit to lock it out and used to lock itself when call buttons are used
Timer = Timer used on the gates and locking mechanism
Code:
N@Elevator
I@A1 A2 B1 B2 C1 C2 D1 D2 E1 E2 F1 F2 G1 G2 H1 H2 EH
O@O L Timer
A1==1 & L==0 -> O=-148, Timer = 0;
A2==1 & L==0 -> O=-148, Timer = 0;
B1==1 & L==0 -> O=-47, Timer = 0;
B2==1 & L==0 -> O=-47, Timer = 0;
C1==1 & L==0 -> O=50, Timer = 0;
C2==1 & L==0 -> O=50, Timer = 0;
D1==1 & L==0 -> O=149, Timer = 0;
D2==1 & L==0 -> O=149, Timer = 0;
E1==1 & L==0 -> O=245, Timer = 0;
E2==1 & L==0 -> O=245, Timer = 0;
F1==1 & L==0 -> O=343, Timer = 0;
F2==1 & L==0 -> O=343, Timer = 0;
G1==1 & L==0 -> O=441, Timer = 0;
G2==1 & L==0 -> O=441, Timer = 0;
H1==1 & L==0 -> O=539, Timer = 0;
H2==1 & L==0 -> O=539, Timer = 0;
L = ((Timer > 15) ? 0 : 1)
Timer = ((EH == O) ? Timer += 1 : 0)
Here is how it looks in game:
Bookmarks