KBrat-SSD541-Final-16-1_Updated
Dependencies: MMA8451Q KBrat-SSD541-Final-16-1 mbed
Fork of ACC_LCD_341_all_axies by
Revision 6:15fbbf84492c, committed 2016-12-05
- Comitter:
- tisbrat
- Date:
- Mon Dec 05 17:22:05 2016 +0000
- Parent:
- 5:9e4173e23e05
- Commit message:
- KBrat-SSD541-Final-16-1
Changed in this revision
SLCD.lib | Show annotated file Show diff for this revision Revisions of this file |
acc_all_axies.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9e4173e23e05 -r 15fbbf84492c SLCD.lib --- a/SLCD.lib Mon Nov 28 15:43:04 2016 +0000 +++ b/SLCD.lib Mon Dec 05 17:22:05 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/scohennm/code/SLCD/#73e8e2c9a5b8 +https://developer.mbed.org/users/tisbrat/code/KBrat-SSD541-Final-16-1/#801a40fce0eb
diff -r 9e4173e23e05 -r 15fbbf84492c acc_all_axies.cpp --- a/acc_all_axies.cpp Mon Nov 28 15:43:04 2016 +0000 +++ b/acc_all_axies.cpp Mon Dec 05 17:22:05 2016 +0000 @@ -14,8 +14,9 @@ #define DATAINTERVAL 0.200 #define LCDWAIT 1.5 #define LCDDATALEN 10 +#define PI 3.14159265 -#define PROGNAME "ACC_LCD_all_axes_v1\r\n" +#define PROGNAME "KBrat-SSD541-Final-16-1" #define PRINTDBUG // @@ -56,6 +57,33 @@ LCDMess(lcdData); } +void LCDsignedAngle(float theAngle){ + sprintf (lcdData," %2.0f@",theAngle); + // changed SLCD.cpp to interpret @ as degrees + if (theAngle < 0.0) sprintf (lcdData,"<%2.0f@",fabs(theAngle)); + LCDMess(lcdData); +} + +void findDegrees(float theRadian){ + } + + +/* +#include <stdio.h> +#include <math.h> + +#define PI 3.14159265 + +int main () +{ + double param, result; + param = 0.5; + result = asin (param) * 180.0 / PI; + printf ("The arc sine of %f is %f degrees\n", param, result); + return 0; +} +*/ + void initialize_global_vars(){ pc.printf(PROGNAME); // set up DAQ timers @@ -72,6 +100,7 @@ int i; // loop index float axisValue[NUMAXES]; // set up an array of axid values int buttonSum = 0; + double degrees; initialize_global_vars(); // main loop forever @@ -97,9 +126,13 @@ #ifdef PRINTDBUG for (i=0; i< NUMAXES;i++){ pc.printf("Acc %d = %f\r\n",i, axisValue[i]); + } + //Change radian using asin (arc sine) to find the degrees + degrees = asin (axisValue[currentAxis]) * 180.0 / PI; #endif - LCDsignedFloat(axisValue[currentAxis]); + // LCDsignedFloat(axisValue[currentAxis]); + LCDsignedAngle(degrees); } } } \ No newline at end of file