ArgonKey sensor board


This sample provides an example of how to read sensor data from the ArgonKey board. The result is displayed on the console. It makes use of both the trigger and poll methods.


This sample just requires the ArgonKey board. The user may select or unselect the sensors from samples/boards/96b_argonkey/prj.conf.

Please note that all sensor related code is conditionally compiled using the #ifdef directive, so this sample is supposed to always build correctly. Example:

#ifdef CONFIG_HTS221
  struct device *hum_dev = device_get_binding("HTS221");

  if (!hum_dev) {
    printk("Could not get pointer to %s sensor\n", "HTS221");


Building and Running

cd $ZEPHYR_BASE/samples/boards/96b_argonkey
mkdir build && cd build
cmake -GNinja -DBOARD=96b_argonkey ..
ninja run

Sample Output

temp: 24.78 C; press: 101.448535
humidity: 43.000000
accel (4.121000 -6.859000 -5.384000) m/s2
gyro (-0.008000 0.270000 0.161000) dps
magn (0.021000 -0.552000 0.271500) gauss
- (6) (trig_cnt: 254)

<repeats endlessly every 2s>

In this example the output is generated polling the sensor every 2 seconds. Sensor data is printed in the following order (no data is printed for sensors that are not enabled):

  1. LPS22HB baro/temp
  2. HTS221 humidity
  3. LSM6DSL accel
  4. LSM6DSL gyro
  5. LIS2MDL magnetometer (attached to LSM6DSL)

The last line displays a counter of how many trigger interrupts has been received. It is possible to display the sensor data read for each trigger by enabling the ARGONKEY_TEST_LOG macro.