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
429 B
C

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