Affichage de la température et de l'humidité
#include <sysio/delay.h>
#include <sysio/hih6130.h>
#include <stdlib.h>
#include <signal.h>
#include <assert.h>
#include <stdio.h>
#define DEFAULT_I2CBUS "/dev/i2c-1"
#define DEFAULT_I2CADDR HIH6130_I2CADDR
xHih6130 * sensor;
static void
vSigIntHandler (int sig) {
if ( (sig == SIGINT) || (sig == SIGTERM)) {
perror ("iHih6130Close");
exit (EXIT_FAILURE);
}
printf ("\n# everything was closed.\n# Have a nice day !\n");
exit (EXIT_SUCCESS);
}
}
int
main (void) {
int ret;
printf ("\n# HIH6130 Demo\n");
signal (SIGINT, vSigIntHandler);
signal (SIGTERM, vSigIntHandler);
printf ("# Press Ctrl+C to abort ...\n");
printf ("# T(°C) H(%%)\n");
for (;;) {
do {
}
printf (
"%.1f %.1f\n", data.
dTemp, data.
dHum);
}
return 0;
}