![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This drive is working well with "LPD3806-600BM-G5-24G", and have Simple program
Diff: Rotary_Encoder.h
- Revision:
- 3:6a91d523b146
- Parent:
- 0:b2ffb830539c
diff -r 7d34758c3cc4 -r 6a91d523b146 Rotary_Encoder.h --- a/Rotary_Encoder.h Fri Feb 08 07:11:22 2019 +0000 +++ b/Rotary_Encoder.h Tue Feb 19 05:31:32 2019 +0000 @@ -19,10 +19,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - 1.0 2-Feb.-2019 - Initial release. + 1.1 19-Feb.-2019 Add return 'float' function + 1.0 2-Feb.-2019 Initial release. - ***************************************************************** + ***************************************************************** Attention: This drive is working well with "LPD3806-600GM-G5-24G' ***************************************************************** @code @@ -53,23 +53,26 @@ class Rotary_Encoder { private: - char Direction[5]; - int Encoder_Counter; - InterruptIn Green_Pin, White_Pin; + char Direction[5]; + int Encoder_Counter; + float Direction_Numb; + InterruptIn Green_Pin, White_Pin; - public: - Rotary_Encoder(PinName White, PinName Green); - // @Param White The pin whitch is connected to the encoder white line. - // @Param Green The pin whitch is connected to the encoder green line. - void Green_Pin_Rise(void); // Change 'Encoder_Direction' when detecting voltage in 'Green Pin' from LOW to HIGH. void White_Pin_Rise(void); // Change 'Encoder_Direction' when detecting voltage in 'White Pin' from LOW to HIGH. - char *Calculate_Direction(void); + public: + Rotary_Encoder(PinName White, PinName Green); + // @Param White The pin whitch is connected to the encoder white line. + // @Param Green The pin whitch is connected to the encoder green line. + + char *Show_Direction_In_char(void); // Return Direciton. + + float Calculate_Direction(void); }; #endif