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.
Dependents: RobotControl_Sample2022 sotsuken_mecha
Diff: IncEncoder.h
- Revision:
- 0:c40c29a063c0
diff -r 000000000000 -r c40c29a063c0 IncEncoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IncEncoder.h Fri Jul 01 06:56:51 2022 +0000 @@ -0,0 +1,34 @@ +#ifndef MBED_INCENCODER_H +#define MBED_INCENCODER_H + +#include "mbed.h" + +class IncEncoder{ +public: + typedef enum Encoding { + x2_Resolution, + x4_Resolution + } Encoding; + + IncEncoder(PinName ENC_A,PinName ENC_B,Encoding encoding); + + int IncEncoder::GetIncPulses(); + + void IncEncoder::reset(); + + void IncEncoder::A_RISE(); + + void IncEncoder::A_FALL(); + + void IncEncoder::B_RISE(); + + void IncEncoder::B_FALL(); + +private: + int pulses; + + InterruptIn ENC_A_; + InterruptIn ENC_B_; +}; + +#endif \ No newline at end of file