Nicolae Marton / Mbed 2 deprecated TDP3_OOP

Dependencies:   mbed

Revision:
1:a2ceed49374e
Child:
3:54c41af9e119
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LineFollowingRobot/IRSensor_H.h	Sat Feb 02 16:11:37 2019 +0000
@@ -0,0 +1,42 @@
+#ifndef IRSensor_H
+#define IRSensor_H
+
+#include <mbed.h>
+#include "RobotControl_H.h"
+
+class IRSensor
+{
+private:
+    
+    DigitalIn m_leftIR;
+    DigitalIn m_midLeftIR;
+    DigitalIn m_midIR;
+    DigitalIn m_midRightIR;
+    DigitalIn m_rightIR;
+
+    bool  m_prevDirL, m_prevDirR;
+    bool m_lineSensor[5];
+    
+    short int m_error, m_prevError;
+    const float m_Kp, m_Ki, m_Kd;
+    float m_P, m_I, m_D;
+    
+
+
+public:
+    
+    bool m_dirL, m_dirR, m_toggle;
+    float m_speedL, m_speedR;
+    
+    IRSensor(PinName pin1, PinName pin2, PinName pin3, PinName pin4, PinName pin5, float Kp, float Ki, float Kd);
+    void Sample();
+    void WeightPID();
+    void CalculatePID();
+    void MotorControl(RobotControl controlLeft, RobotControl controlRight);
+    
+    
+};
+
+
+
+#endif
\ No newline at end of file