Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LineFollowingRobot/IRSensor_H.h
- Committer:
- Nicolaemf
- Date:
- 2019-02-02
- Revision:
- 1:a2ceed49374e
- Child:
- 3:54c41af9e119
File content as of revision 1:a2ceed49374e:
#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