What you learn today
- Light, heating and pressure warning in one chip
- Dominik's style
- Handle sensor failure
Three months of beginner level end with a chip that looks after a whole habitat module. It heats, switches the light, warns about wrong pressure and stays safe when the sensor fails. You already know everything you need for it.
The setup
| Device | Prefab | Name |
|---|---|---|
| gas sensor | StructureGasSensor | Wohnraum |
| wall heater | StructureWallHeater | Wohnheizung |
| wall lights | StructureWallLight | Wohnlicht |
| lever | StructureLogicSwitch | Licht |
| flashing light | StructureFlashingLight | Druckalarm |
| LED display | StructureConsoleLED5 | Wohntemp |
Milestones
- Heater: on below 20 °C, off from 22 °C, keep the state in between.
- Light: the habitat lights follow the lever. If the lever is missing, the light stays on.
- Pressure warning and display: below 90 kPa or above 110 kPa “Druckalarm” lights up. The display shows the temperature in °C.
- Sensor failure: heater off, pressure alarm on, display −999.
Dominik's style
Build the chip so that you still understand it in three months:
- a header comment at the very top, then the settings block with a
definefor every hash and every limit, with a comment - an
aliasfor every register - sections with
# --- 1. … --- - devices only via
lbnandsbnwithHASH("Name"), batch modeAverage - bring everything into a safe state before the start label, one
yieldin the main loop
# --- 3. Light by lever, on without lever ---
lbn light LEVER HASH("Licht") Open Average
snan tmp light
select light tmp 1 light
sbn LAMP HASH("Wohnlicht") On light
Read temperature and pressure from the same sensor. One snan on the temperature then covers both cases.
Check every line with a reading for NaN. The heater switches off by itself, but the pressure alarm does not: slt and sgt are both 0 with NaN.
Diagram
Project task
Task
Build the chip for the habitat module with the devices and names from the table. The milestones are listed above the editor.
Milestones
- Milestone 1: heater with hysteresis
- Milestone 2: light by lever, on without lever
- Milestone 3: pressure alarm and display
- Milestone 4: sensor failure
Hints
Hint 1
Heater: the and/or pattern with LOWER and UPPER.
Hint 2
Light: snan on the lever value and select light tmp 1 light.
Hint 3
Pressure alarm: slt, sgt, two or, the second with missing. Display: convert, then select.
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