Affichage de la densité de particules fines
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <signal.h>
#include <sysio/delay.h>
#include <sysio/gp2.h>
static xG2pSensor * gp2;
static void
vSigIntHandler (int sig) {
perror ("iGp2Close");
exit (EXIT_FAILURE);
}
printf ("\neverything was closed.\nHave a nice day !\n");
exit (EXIT_SUCCESS);
}
int
main (int argc, char **argv) {
.dD1 = 0,
.dV2 = 3000,
.dD2 = 400
};
int v, d;
if (gp2 == NULL) {
perror ("xGp2Open");
exit (EXIT_FAILURE);
}
signal (SIGINT, vSigIntHandler);
printf ("Press Ctrl+C to abort ...\n");
printf ("v(mV),d(ug/m3)\n");
for (;;) {
if (v >= 0) {
printf ("%u,%u\n", v, d);
}
}
return 0;
}