ライブラリ化を行った後

Dependencies:   QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo

Fork of 17robo_Practice1 by kusano kiyoshige

Revision:
3:9ef929639c4a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accelerator.h	Fri Jun 30 00:55:12 2017 +0000
@@ -0,0 +1,23 @@
+class Accel
+{
+public  :
+    void setup(float Acceleration, float time) {
+        a = Acceleration*time;
+        v = 0;
+    }
+    
+    float duty(float target) {
+        if (fabs(target-v) <= a){
+            v = target;
+        } else if (v < target) {
+            v = v + a;
+        } else if (v > target) {
+            v = v - a;
+        }
+        return v;
+    }
+
+private :
+    float a;
+    float v;
+};
\ No newline at end of file