upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
Include dependency graph for collision.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 "collision.h"
#include "upm_utilities.h"
int main()
{
bool abc = 0;
while(1){
if(collision_is_colliding(dev, &abc) != UPM_SUCCESS){
printf("an error has occurred\n");
}
upm_delay(1);
printf("value retrieved: %d\n", abc);
}
}

Go to the source code of this file.

Data Structures

struct  _collision_context
 

Functions

collision_context collision_init (int pin)
 
void collision_close (collision_context dev)
 
upm_result_t collision_is_colliding (collision_context dev, bool *collision_val)
 

Typedefs

typedef struct _collision_contextcollision_context
 

Function Documentation

collision_context collision_init ( int  pin)

Collision Initialization function

Parameters
pinnumber
Returns
void* pointer to the sensor struct
void collision_close ( collision_context  dev)

Collision Initialization function

Parameters
void*pointer to the sensor struct
upm_result_t collision_is_colliding ( collision_context  dev,
bool *  collision_val 
)

This function tells you whether the sensor has collided with something or not.

Parameters
void*pointer to the sensor struct
bool*pointer to hold the collision value
Returns
upm_result_t UPM success/error code

Typedef Documentation

device context