What you learn today
- Button opens, timer closes
- Interlock of two doors
- Status lights
This week you built edges, timers, sequences and interlocks. Now everything comes together: a door control for the vestibule between the living area and the garage.
The setup
| Device | Prefab | Name |
|---|---|---|
| inner door | StructureCompositeDoor | Innentuer |
| outer door | StructureCompositeDoor | Aussentuer |
| inner button | StructureLogicButton | TasterInnen |
| outer button | StructureLogicButton | TasterAussen |
| inner status lamp | StructureWallLight | SperreInnen |
| outer status lamp | StructureWallLight | SperreAussen |
A button press opens “its” door. After OPENTIME ticks it closes by itself. While one door is open, the other stays closed and locked, and its status lamp lights up.
Milestones
- Button opens, timer closes: a press on “TasterInnen” opens the inner door. After
OPENTIMEticks it is closed again. - Interlock: while the inner door is open, “TasterAussen” does nothing. The same the other way round.
- Status lamps: a door’s lamp lights up while this door is locked because the other one stands open.
- Failure: if one door is missing, the other no longer opens.
Building blocks
Per door you need an edge and a timer that is set to OPENTIME on opening and then runs down:
sgt edge btnIn lastIn # press inside?
move lastIn btnIn
and edge edge shutOut # only if outside is closed
select timeIn edge OPENTIME timeIn
sub timeIn timeIn 1
max timeIn timeIn 0
sgtz openIn timeIn
For the outer door priority comes on top: it only opens if the inner door is neither open nor opening in the same tick. So work out the inner door first and check openIn afterwards.
The status lamp is simply the state of the other door: if the inner door is open, “SperreAussen” lights up.
A door whose value is NaN counts as open. seqz then returns 0, and the other door stays closed. That is exactly what the last milestone checks.
Project task
Task
Build the door control for the vestibule with the devices and names from the table. OPENTIME is 8 ticks (4 s). The milestones are listed above the editor.
Milestones
- Milestone 1: button opens, timer closes
- Milestone 2: interlock in both directions
- Milestone 3: status lamps
- Milestone 4: outer door missing
Hints
Hint 1
Read both buttons and the state of both doors (seqz for “closed”).
Hint 2
Inner door: edge, and with shutOut, timer with select, count down, sgtz.
Hint 3
Outer door the same, plus and with shutIn and with seqz tmp openIn. Lamps: SperreInnen = openOut, SperreAussen = openIn.
Quiz
2 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in