KBrat-SSD541-HW-15-1

Dependencies:   MMA8451Q KBrat-SSD541-HW-15-1 mbed

Fork of ACC_LCD_341_Basic by Stanley Cohen

Revision:
2:6003ed409def
Parent:
1:9340a340e588
Child:
3:c5291c70af48
diff -r 9340a340e588 -r 6003ed409def acc_341.cpp
--- a/acc_341.cpp	Thu Sep 25 16:27:26 2014 +0000
+++ b/acc_341.cpp	Thu Sep 25 23:45:35 2014 +0000
@@ -13,10 +13,10 @@
 #define PROGNAME "ACCLCD341\r/n"
 
 #define PRINTDBUG
-
+// 
 #if   defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
-  PinName const SDA = PTE25;
-  PinName const SCL = PTE24;
+  PinName const SDA = PTE25;  // Data pins for the accelerometer/magnetometer.
+  PinName const SCL = PTE24;  // DO NOT CHANGE
 #elif defined (TARGET_KL05Z)
   PinName const SDA = PTB4;
   PinName const SCL = PTB3;
@@ -31,7 +31,10 @@
 MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
 Serial pc(USBTX, USBRX);
 
-
+float sqrt_newt(float argument) {
+    return (sqrt(argument));
+}
+   
 
 void LCDMess(char *lMess, float dWait){
         slcd.Home();
@@ -57,7 +60,7 @@
         xAcc = abs(acc.getAccX());
         yAcc = abs(acc.getAccY());     
  // Calulate vector sum of x and y reading.       
-        vector = sqrt(pow(xAcc,2) + pow(yAcc,2));
+        vector = sqrt_newt(pow(xAcc,2) + pow(yAcc,2));
         
  
 #ifdef PRINTDBUG