What you learn today
- Plan names
- Encode rooms and functions
- Use the labeller efficiently
At first the first heater is called “Heizung”. Three months later you have eleven heaters, and the chip in the lab switches the one in the greenhouse as well. Names are the addresses of your base. Planning them saves you a lot of searching.
What a name has to do
lbn and sbn find devices by type and name. Two rules follow from that:
- Same name, same type is a group. One
sbnswitches them all together. - Same name, different type does no harm. Sensor “Labor” and heater “Labor” do not get in each other's way, because
lbnchecks the type as well.
The second rule is a big advantage: you can name all devices of a room after the room. The type tells them apart.
Encoding rooms and functions
A proven scheme has two parts: place and, where needed, function.
| Name | Meaning |
|---|---|
Labor | all devices in the lab that exist only once per type there |
Labor Not | the emergency light in the lab, separate from the normal one |
Gewaechshaus | sensor, heater, lamps in the greenhouse |
Gewaechshaus Pflanzen | only the grow lights |
Spaces are allowed, HASH("Labor Not") works. Umlauts are not: the checker warns, and the game only stores ASCII. Write “Gewaechshaus”, not “Gewächshaus”.
Keep names short, every HASH("…") costs characters from your 4096. And write a name the same way every time: “Labor” and “labor” give different hashes.
The labeller
In the game names are given with the labeller. It needs a battery and has to be switched on. It becomes efficient with a list:
- Write down all names before you set off, ideally straight as a
defineblock. - Name one room after the other, all devices at once.
- Check with the chip: an
lbn … Averagethat returns NaN points to a typo.
define LAB HASH("Labor") # room lab
define LABEMERG HASH("Labor Not") # emergency light lab
lbn temp SENSOR LAB Temperature Average
sbn LAMP LABEMERG On missing
A name hits all devices of this type with this name on the whole data network. If two parts of the base share one network, a “Licht” can sit in each of them. A unique place in the name prevents a chip from switching in the wrong room.
With one define per name you write the name only once. A typo then shows up in exactly one place.
Diagram
Exercise
Task
Two rooms following the scheme “place” and “place Not”: in the lab the gas sensor and the wall heater are called “Labor”, in the kitchen both are called “Kueche”. The emergency lights are called “Labor Not” and “Kueche Not”. The lab also has a normal wall light “Labor” that the chip must not switch.
- per room: heater on below 20 °C, off from 22 °C
- if a room's sensor fails: its heater off, its emergency light on, the other room carries on normally
Hints
Hint 1
The name from the define applies to sensor and heater, the type tells them apart.
Hint 2
Every room needs its own register for the heating state, temp and tmp may be shared.
Hint 3
Emergency light: snan missing temp and sbn LAMP LABEMERG On missing – not LAB, or it hits the normal light.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- 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