Light is the first thing you miss in a new base, and an alarm the first thing you want after your first pressure loss. Both hang on the same network as your chips and are switched with the same tools.
The lamps
The Kit (Lights) from the Autolathe or the Electronics Printer builds ten different lights. The most important ones:
| Light | Power | Size |
|---|---|---|
| Wall Light | 50 W | one cell (0.5 m) |
| Wall Light (Long) | 50 W | three cells (1.5 m) |
| Light Round | 50 W | one cell |
| Wall Light (Battery) | 25 W | one cell |
| LED | 25 W | one cell |
There are also angled, wide and small forms. All of them mount in the 0.5 m grid on a wall, floor or ceiling and have one shared port for power and data.
The logic values are the same on all of them: On switches, Lock locks manual operation, Power and RequiredPower show the power. One sbn to the shared name switches a whole floor.
What light costs
Lamps are small consumers, but many small consumers make a big one. A worked example:
- 12 wall lights × 50 W = 600 W.
- A Station Battery stores 3,600,000 J.
- 3,600,000 J ÷ 600 W = 6,000 s. On paper a full battery therefore lasts about 100 minutes for the lights alone.
If you only switch on light where somebody is, the saving is real. A motion sensor with run-on does that – the program is in Sensors: gas, daylight, motion, occupancy.
Flashing light and klaxon
The Flashing Light draws 50 W and comes from its own kit, the Kit (Flashing Light). It has the same values as a lamp, On and Lock, and is switched the same way. A chip only has to turn it on and off.
The Klaxon Speaker draws 40 W and comes from the Kit (Speaker). Unlike the lamps it sits in a small cell of its own and can be rotated in any direction. Its values:
Mode– which sound plays,SoundAlert– the same value asModeunder another name,On– sound on or off,Volume– the volume in percent: 50 by default, 1 to 100 in steps of ten by hand with the screwdriver, 1 to 200 through logic. According to the game code it acts as a factor ofVolume÷ 50, so 100 is twice as loud as the default.
By hand you also pick the sound with the screwdriver; one click switches to the next, with the C key held to the previous one.
Mode knows 46 sounds. In a program it is best to write them by name, for example Sound.PressureLow:
| Number | Name | Number | Name |
|---|---|---|---|
| 0 | None | 24 | SystemFailure |
| 15 | Danger | 26 | MalfunctionDetected |
| 16 | Warning | 28 | FireFireFire |
| 17 | Alert | 39 | PressureHigh |
| 18 | StormIncoming | 40 | PressureLow |
| 20 | Depressurising | 41 | TemperatureHigh |
| 21 | Pressurising | 42 | TemperatureLow |
| 22 | AirlockCycling | 43 | PollutantsDetected |
| 23 | PowerLow | 44 | HighCarbonDioxide |
Among the others are twelve alarm tones (Alarm1 to Alarm12), three pieces of music, the numbers One to Five and announcements for traders and rocket launches.
Program: alarm with the right announcement
A gas sensor watches the workshop. If the pressure drops below 80 kPa, the speaker announces PressureLow. If the pollutant partial pressure reaches 0.5 kPa – according to the game data the warning threshold, damage starts at 1 kPa – PollutantsDetected takes priority. If the sensor does not answer, the alarm reports MalfunctionDetected. The flashing light runs with every alarm.
# Alarm: pressure too low or pollutant in the air
define SENSOR -1252983604 # Gas Sensor (StructureGasSensor)
define HORN -828056979 # Klaxon Speaker (StructureKlaxon)
define FLASH -1535893860 # Flashing Light (StructureFlashingLight)
define NSENSOR HASH("Workshop Sensor")
define NHORN HASH("Workshop Horn")
define NFLASH HASH("Workshop Warning")
define PMIN 80 # kPa, alarm below
define TOXMAX 0.5 # kPa pollutant partial pressure, alarm from here
define SNDPRESSURE Sound.PressureLow
define SNDTOXIC Sound.PollutantsDetected
define SNDFAULT Sound.MalfunctionDetected
alias pressure r0
alias ratio r1
alias toxic r2
alias sound r3
alias alarm r4
alias tmp r5
alias last r6
move last -1 # forces the first write
start:
yield
lbn pressure SENSOR NSENSOR Pressure 0
bnan pressure fault
lbn ratio SENSOR NSENSOR RatioPollutant 0
bnan ratio fault
mul toxic pressure ratio # pollutant partial pressure in kPa
move sound 0 # 0 = no sound
slt tmp pressure PMIN
select sound tmp SNDPRESSURE sound
sge tmp toxic TOXMAX
select sound tmp SNDTOXIC sound # pollutant takes priority
snez alarm sound
j report
fault:
move sound SNDFAULT
move alarm 1
report:
beq sound last start # nothing changed: do not write again
move last sound
sbn HORN NHORN Mode sound
sbn HORN NHORN On alarm
sbn FLASH NFLASH On alarm
j start
The program only writes to the speaker and the flashing light when the sound changes. According to the game code, every write of Mode or On triggers the speaker's sound events again, even with the same value. A looping sound simply keeps playing, but a one-off announcement could start over every half second.
A worked example on the threshold: at 100 kPa total pressure and a pollutant fraction of 0.005 (0.5 %), mul gives exactly 0.5 kPa – the alarm goes on. Half a percent is already enough.
The three define lines with Sound. are allowed because each name is a number directly. A define that takes another define as its value, on the other hand, would give NaN.
Program: blinking without a flashing light
Sometimes a normal lamp should blink, say above an emergency exit. A counter toggles it every second:
# Make wall lights blink: 1 s on, 1 s off
define LIGHT -1860064656 # Wall Light (StructureWallLight)
define NLIGHT HASH("Exit Light") # name of the lights
define TICKS 2 # 2 ticks x 0.5 s = 1 s per phase
alias counter r0
alias run r1
start:
yield
add counter counter 1
blt counter TICKS start # phase not over yet
move counter 0
seqz run run # toggle: 0 becomes 1, 1 becomes 0
sbn LIGHT NLIGHT On run
j start
With TICKS 4 the lamp blinks more slowly, 2 s on and 2 s off. Shorter than one tick is not possible: device values only change once every 0.5 s.
Typical mistakes
- The speaker stays silent:
Modeis 0 (None), orOnis 0. Both must be set. - The alarm keeps switching on and off: the value hovers around the limit. A hysteresis with two limits helps, see IC10: control a device by name.
- The alarm reports
MalfunctionDetected: there is no sensor with that name on the network – check the name and the cable. - Light flickers: two programs switch the same lamps with the same name against each other.
- Everything goes off at night: the network is overloaded. Add up the watts of all lamps, see Power grid basics.
Next steps
- Sensors: gas, daylight, motion, occupancy – motion detectors and light with run-on
- Displays and consoles: LED displays, consoles, circuit boards – showing values in colour
- Building: frames, walls, windows, floors, grid – where lamps and devices sit
- Academy: alarms and sounds, building a blinker, traffic light