e_accelerometer.h File Reference

Accessing the accelerometer sensor data. More...


Functions

void e_init_acc (void)
 Init the accelerometer A/D converter.
void e_get_acc (int *x, int *y, int *z)
 To get the analogic x, y, z axis accelerations.


Detailed Description

Accessing the accelerometer sensor data.

A little exemple to read the accelerator.

 #include <p30f6014A.h>
 #include <motor_led/e_epuck_ports.h>
 #include <motor_led/e_init_port.h>
 #include <a_d/e_accelerometer.h>
 
 int main(void)
 {
        int x, y, z;
        e_init_port();
        e_init_acc();
        while(1)
        {
                long i;
                e_get_acc(&x, &y, &z);
                if(z < 2100)    //LED4 on if e-puck is on the back
                {
                        LED0 = 0;
                        LED4 = 1;
                }
                else            //LED0 on if e-puck is on his wells
                {
                        LED0 = 1;
                        LED4 = 0;
                }
                for(i=0; i<100000; i++) { asm("nop"); }
        }
 }
Author:
Code: Michael Bonani
Doc: Jonathan Besuchet

Function Documentation

void e_get_acc ( int *  x,
int *  y,
int *  z 
)

To get the analogic x, y, z axis accelerations.

Parameters:
x A pointer to store the analogic x acceleration
y A pointer to store the analogic y acceleration
z A pointer to store the analogic z acceleration

void e_init_acc ( void   ) 

Init the accelerometer A/D converter.

Warning:
Must be called before starting using accelerometer


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