Committed for sharing.
Dependencies: mbed SelfBalancingRobot_BerkYasarYavuz_AdilBerkayTemiz Motor ledControl2 HC_SR04_Ultrasonic_Library
Diff: HALLFX_ENCODER.cpp
- Revision:
- 11:0a2944e7be23
- Parent:
- 10:8050817ae610
--- a/HALLFX_ENCODER.cpp Thu Aug 25 22:55:36 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#include "HALLFX_ENCODER.h" - -HALLFX_ENCODER::HALLFX_ENCODER(PinName enc_in): _enc_in(enc_in){ - _enc_in.mode(PullUp); - // Invoke interrupt on both falling and rising edges - _enc_in.fall(this, &HALLFX_ENCODER::callback); - _enc_in.rise(this, &HALLFX_ENCODER::callback); -} - -long HALLFX_ENCODER::read(){ - return count; -} - -void HALLFX_ENCODER::reset(){ - count = 0; -} - -void HALLFX_ENCODER::callback(){ - count++; -} \ No newline at end of file