You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
448 B
C

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "ezodo.h"
int main()
{
int fd = open("/dev/i2c-1", O_RDWR);
if (fd < 0)
{
fprintf(stderr, "%s\n", strerror(errno));
return -1;
}
double oxygen;
if (getDO(fd, &oxygen) < 0)
{
close(fd);
return -1;
}
printf("{ \"do\": %.3f }\n", oxygen);
close(fd);
return 0;
}