Speed sensor for tasdevelop
Dependencies: BLE_API MMA8451Q_ss mbed
Fork of FRDM_MMA8451Q by
Diff: main.cpp
- Revision:
- 5:973da26ee266
- Parent:
- 2:9d566ea4f4fa
- Child:
- 6:fbce7ee68c07
--- a/main.cpp Tue Mar 17 07:30:21 2015 +0000 +++ b/main.cpp Thu Mar 19 02:34:45 2015 +0000 @@ -98,14 +98,14 @@ float x = acc.getAccX(); float y = acc.getAccY(); float z = acc.getAccZ(); - float xyz = sqrt(x*x+y*y+z*z); if(f==0){ dxyz += xyz - oxyz; } f=0; - velocity = dxyz*9.8*3600/1000/10; + velocity = dxyz*9.8; + velocity *= 3600/1000/10; oxyz = xyz; pc.printf("X: %7.2f, Y: %7.2f, Z: %7.2f v:%7.2f\r\n", x, y, z, velocity);