Output target value of PID

Revision:
0:90457f6c41ea
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PIDcontroller.h	Fri Aug 10 07:22:48 2018 +0000
@@ -0,0 +1,50 @@
+/*
+ * タイトル:PID制御用のプログラム
+ * 説明    :目標値に対しての出力を返す
+ *製作者:Uchida Masayuki
+ * 変更履歴:2018.08.10 
+ *
+ */
+
+
+/*
+メソッドの説明
+コンストラクタ 刻み値(割り込み値)を代入
+print()       //目標値に対する出力値を表示
+output(float 実際の値,float 目標値);       //
+
+*/
+
+
+
+#ifndef PIDcontroller_H
+#define PIDcontroller_H
+ 
+#include "mbed.h"
+
+
+class PIDController{
+private:
+    float diff1;
+    float diff2;
+    float integral;
+    float delta_t;
+    static const float KP=0.005;
+    float KI;
+    float KD;
+    float sum;
+
+public:
+    PIDController(float dt){
+        diff1=0;
+        diff2=0;
+        integral=0;
+        KI=KP/dt;
+        KD=KP*dt;    
+        this->delta_t=dt;
+    } //コンストラクタ
+    float output(float sensorVal,float targetVal);
+    void print();
+
+};
+#endif
\ No newline at end of file