Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
quadv3/accelero.h
- Committer:
 - Anaesthetix
 - Date:
 - 2013-01-30
 - Revision:
 - 0:978110f7f027
 
File content as of revision 0:978110f7f027:
#ifndef ACCELERO_H
#define ACCELERO_H
#include "mbed.h"
#include "math.h"
#include "ADXL345.h"
#define PI 3.141592654
typedef struct
{
    float x;
    float y;
    float z;
    } Acc;
 int readings[3] = {0, 0, 0};
  float yreading = 0;
  float xreading = 0;
  float zreading = 0;
  float ax = 100;
  float ay = 100;         
ADXL345 accel(p5, p6, p7, p8);
Acc acc;
void accstart(void);
void accread(void);
void accsample(void);
void accstart(void) {
  accel.setPowerControl(0x00);
  accel.setDataFormatControl(0x0B);
  accel.setDataRate(ADXL345_3200HZ);
  accel.setPowerControl(0x08);
  }
  
void accread(void) {
            
            
         
    }
    
    
void accsample(void) {
    accel.getOutput(readings);
    xreading = ((int16_t)readings[0]);
    yreading = ((int16_t)readings[1]);
    
    }
    
    
    
    
#endif