upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
moisture.h File Reference
Include dependency graph for moisture.h:

API Description

//Modified: Abhishek Malik <abhishek.malik@intel.com>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "moisture.h"
#include "upm_utilities.h"
int main()
{
int val;
while(1){
if(moisture_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);
}
return 0;
}

Go to the source code of this file.

Data Structures

struct  _moisture_context
 

Functions

moisture_context moisture_init (int pin)
 
void moisture_close (moisture_context dev)
 
upm_result_t moisture_get_moisture (moisture_context dev, int *moisture)
 

Typedefs

typedef struct _moisture_contextmoisture_context
 

Function Documentation

moisture_context moisture_init ( int  pin)

Init function

Parameters
pinanalog pin number
Returns
void* pointer to the sensor struct
void moisture_close ( moisture_context  dev)

Close function

Parameters
devpointer to the sensor structure
upm_result_t moisture_get_moisture ( moisture_context  dev,
int *  moisture 
)

Get Moisture function.

Parameters
devpointer to the sensor struct
moisturepointer that will be used to store the output value from the sensor

Typedef Documentation

device context