e_prox.h File Reference

Accessing proximity sensor of e-puck. More...


Functions

void e_calibrate_ir ()
 To calibrate your ir sensor.
int e_get_prox (unsigned int sensor_number)
 To get the analogic proxy sensor value of a specific ir sensor.
int e_get_calibrated_prox (unsigned int sensor_number)
 To get the calibrated value of the ir sensor.
int e_get_ambient_light (unsigned int sensor_number)
 To get the analogic ambient light value of a specific ir sensor.


Detailed Description

Accessing proximity sensor of e-puck.

The functions of this file are made to deal with the proximitiy data. You can know the value of the ambient light detected by the sensor. You can estimate the distance between the e-puck and an obstacle by using e_get_prox function.

A little exemple which turn the LED0 when an obstacle is detected by the proximity sensor number 0.

 #include <p30f6014A.h>
 #include <motor_led/e_epuck_ports.h>
 #include <motor_led/e_init_port.h>
 #include <a_d/advance_ad_scan/e_prox.h>
 #include <a_d/advance_ad_scan/e_ad_conv.h>
 
 int main(void)
 {
        int proxy0;
        e_init_port();
        e_init_ad_scan();
        while(1)
        {
                long i;
                proxy0 = e_get_prox(0);
                if(proxy0 < 1000)
                        LED0 = 0;
                else
                        LED0 = 1;
                for(i=0; i<100000; i++) { asm("nop"); }
        }
 }
Author:
Code: Lucas Meier
Doc: Jonathan Besuchet

Function Documentation

void e_calibrate_ir (  ) 

To calibrate your ir sensor.

Warning:
Call this function one time before calling e_get_calibrated_prox

int e_get_ambient_light ( unsigned int  sensor_number  ) 

To get the analogic ambient light value of a specific ir sensor.

This function return the analogic value of the ambient light measurement.

Parameters:
sensor_number The proxy sensor's number that you want the value. Must be between 0 to 7.
Returns:
The analogic value of the specified proxy sensor
To get the analogic ambient light value of a specific ir sensor.

This function retur the analogic value of the ambient light measurement.

Parameters:
sensor_number The proxy sensor's number that you want the value. Must be between 0 to 7.
Returns:
The analogic value of the specified proxy sensor

int e_get_calibrated_prox ( unsigned int  sensor_number  ) 

To get the calibrated value of the ir sensor.

This function return the calbrated analogic value of the ir sensor.

Warning:
Befroe using this function you have to calibrate your ir sensor (only one time) by calling e_calibrate_ir().
Parameters:
sensor_number The proxy sensor's number that you want the calibrated value. Must be between 0 to 7.
Returns:
The analogic value of the specified proxy sensor

int e_get_prox ( unsigned int  sensor_number  ) 

To get the analogic proxy sensor value of a specific ir sensor.

To estimate the proxymity of an obstacle, we do the following things:

The result value of this function is: reflected light. More this value is great, more the obsacle is near.

Parameters:
sensor_number The proxy sensor's number that you want the value. Must be between 0 to 7.
Returns:
The analogic value of the specified proxy sensor
To get the analogic proxy sensor value of a specific ir sensor.

To estimate the proxymity of an obstacle, we do the following things:

The result value of this function is: reflected light. More this value is great, more the obsacle is near.

Parameters:
sensor_number The proxy sensor's number that you want the value. Must be between 0 to 7.
Returns:
The analogic value of the specified proxy sensor


Generated on Fri Feb 29 14:26:53 2008 for e-puck by  doxygen 1.5.4