2016-09-09 19:19:35 -07:00
|
|
|
//Modified: Abhishek Malik <abhishek.malik@intel.com>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "grovemoisture.h"
|
|
|
|
|
2016-09-19 15:45:22 -07:00
|
|
|
#include "upm_utilities.h"
|
|
|
|
|
2016-09-10 13:29:34 -07:00
|
|
|
int main()
|
2016-09-09 19:19:35 -07:00
|
|
|
{
|
2016-09-19 15:45:22 -07:00
|
|
|
grovemoisture_context dev = grovemoisture_init(14);
|
|
|
|
int val;
|
|
|
|
while(1){
|
|
|
|
if(grovemoisture_get_moisture(dev, &val) != UPM_SUCCESS){
|
|
|
|
printf("Failed to get any values from the sensor\n");
|
|
|
|
}
|
|
|
|
printf("Moisture Value: %d\n", val);
|
|
|
|
upm_delay(1);
|
|
|
|
}
|
|
|
|
grovemoisture_close(dev);
|
2016-09-09 19:19:35 -07:00
|
|
|
|
2016-09-19 15:45:22 -07:00
|
|
|
return 0;
|
2016-09-09 19:19:35 -07:00
|
|
|
}
|
|
|
|
|