James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
19:06f4d39b9290
Parent:
18:e5eb50c5e61f
Child:
22:fa2e0b58043a
diff -r e5eb50c5e61f -r 06f4d39b9290 Paddle/Paddle.cpp
--- a/Paddle/Paddle.cpp	Tue Apr 23 18:25:52 2019 +0000
+++ b/Paddle/Paddle.cpp	Tue Apr 23 18:37:58 2019 +0000
@@ -34,6 +34,8 @@
 
 void Paddle::update(Direction d,float mag)
 {
+    acc.init();
+    
     if (_tilt == false) {
         _speed = int(mag*10.0f);  // scale is arbitrary, could be changed in future
     
@@ -57,7 +59,7 @@
     
         Data values = acc.get_values();
         float roll_rad = atan2(values.ay,values.az);
-        _speed = int((roll_rad*(360/3.14159265))*0.5f);  // scale is arbitrary, could be changed in future
+        _speed = int((roll_rad*(360/3.14159265))*0.3f);  // scale is arbitrary, could be changed in future
     
         // update y value depending on direction of movement
         // North is decrement as origin is at the top-left so decreasing moves up