2018 HongoMechaTech A

Dependencies:   mbed

Revision:
0:e83b840a5f86
diff -r 000000000000 -r e83b840a5f86 lib/LinearFunction.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/LinearFunction.h	Tue Sep 18 03:11:01 2018 +0000
@@ -0,0 +1,29 @@
+#ifndef LINER_FUNCTION_H_
+#define LINER_FUNCTION_H_
+
+#include "mbed.h"
+
+#define LF_MAX_TIME 1000
+
+class LinearFunction
+{
+public:
+    LinearFunction(unsigned int op_period_ms);
+    void set(const double val, const double intercept, const unsigned int ct_ms);
+    void reset();
+    double get_val();
+private:
+    double _op_period;
+    //double _val;
+    double _range;
+    double _intercept;
+    double _ct_s;
+    double _current_val;
+    
+    Ticker _ticker;
+    Timer _timer;
+    
+    void _on_operate();
+};
+
+#endif
\ No newline at end of file