YEah

Dependents:   I2C_Temp_sensor IR_Helicopter_Controller

Fork of AccelSensor by David Gronlund

Files at this revision

API Documentation at this revision

Comitter:
Alegrowin
Date:
Tue Jan 15 21:58:11 2013 +0000
Parent:
0:7dd118f48b1b
Commit message:
Accel is working; Angle is displayed by Serial on 7seg display

Changed in this revision

AccelSensor.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7dd118f48b1b -r 9e97f68b2654 AccelSensor.cpp
--- a/AccelSensor.cpp	Thu Dec 06 17:50:14 2012 +0000
+++ b/AccelSensor.cpp	Tue Jan 15 21:58:11 2013 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 #include "AccelSensor.h"
+Serial pc1(USBTX, USBRX); // tx, rx
 
 AccelSensor::AccelSensor(PinName sda, PinName scl) : _i2c(sda, scl) {
     //No need to initialise anything else.
@@ -27,6 +28,8 @@
 
 void AccelSensor::readData(int *destination) {
     char rawData[6]; // x/y/z accel register data stored here
+    
+    
     readRegisters(OUT_X_MSB, 6, rawData); // Read the six raw data registers into data array
     // Loop to calculate 12-bit ADC and g value for each axis
     for(int i = 0; i < 3 ; i++) {
@@ -38,6 +41,7 @@
         }
         destination[i] = value;
     }
+    pc1.printf("Raw: %d %d %d %d %d %d\r\n" , rawData[0],rawData[1],rawData[2],rawData[3],rawData[4],rawData[5]);
 }
 
 void AccelSensor::readRegisters(char reg, int range, char* dest) {