This sets the critical temperature to 20°C and the hysteresis to 19°C. After this, if the temperature goes above 20°C the LED on the board will come on and stay on until the temperature drops below 19°C. Notice that you need to run this program with root permissions as it is writing to files in /sys.
In chapter but not in this extract:
Industrial I/O
An Example - The HTU21
The IIO Utilities
The Libiio Library
Summary
The IIO and Hwmon systems are attempt to create drivers that present a standard interface, irrespective of the way that the devices are actually interfaced to the machine.
Hwmon is the older system and was originally intended only for devices that are built into the system rather than discrete devices connected via external buses.
The LM75 Temperature Sensor is often found built in to monitor hardware operating conditions, but it can also be connected via I2C and interfaced using the hwmon driver.
Industrial I/O (IIO) was invented as an extension of Hwmon to create something that could support a wide range of sensors.
IIO has many sophisticated features including triggers that can be used to make regular measurements in kernel space – most drivers don’t support this.
The HTU21 introduced in Chapter 12 has an IIO driver.
There are a set of IIO utilities that you can install but again due to limited driver support many features don’t work.
There is also a more sophisticated library, Libiio, which makes IIO devices easier to work with, but lack of driver support makes it less attractive than working directly with devices.
The offspring of that partnership is pg_duckdb, an extension that embeds the DuckDB engine into the PostgreSQL database, allowing it to handle analytical workloads.
Findings from GitHub show that code authored with Copilot has increased functionality and improved readability, is of better quality, and receives higher approval rates than code authored without it.