John Curran
/
mbed_Lab3_Digital_sensorsandequations_in_C_JohnCurranT00214119
Lab 3ES_ John Curran T00214119
Diff: main.cpp
- Revision:
- 5:72d55b40feef
- Parent:
- 4:efd9328bb9f0
- Child:
- 6:50b706a10a68
--- a/main.cpp Sat Apr 17 17:35:23 2021 +0000 +++ b/main.cpp Sat Apr 17 18:34:38 2021 +0000 @@ -9,24 +9,27 @@ DigitalOut connectionLed(LED1); -float calculateAngle(float x, float y, float z, float val, float ret){ +float calculateAngle(float x, float y, float z, float val, float ret) +{ float angle =0; - - val = 180.0 / PI; + + val = 180.0 / PI; - ret = atan (x) * val; - ret = atan (y) * val; - ret = atan (z) * val; - printf("The arc tangent of %lf. %lf, %lf is %lf degrees \n\r ", x, y, z, ret); - - - return angle; + ret = atan (x) * val; + ret = atan (y) * val; + ret = atan (z) * val; + ret = ('atan (x) )/ (sqrt float pow(y) *(y) ) + sqrt float pow(z)* val'); + printf("The arc tangent of %lf is %lf degrees \n\r ", x, y, z, ret); + + + return angle; } -int main() { +int main() +{ if (MMA.testConnection()) connectionLed = 1; - + while(1) { float val; float ret;