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.
Diff: quadv3/accelero.h
- Revision:
- 0:978110f7f027
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/quadv3/accelero.h	Wed Jan 30 13:14:44 2013 +0000
@@ -0,0 +1,66 @@
+#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
\ No newline at end of file