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.
Dependencies: MMA8451Q SLCD mbed
Fork of ACC_LCD_341_MID by
Diff: acc_341.cpp
- Revision:
- 2:6003ed409def
- Parent:
- 1:9340a340e588
- Child:
- 3:c31fe28c4673
--- 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
