zhouhang shao
/
test
test
Embed:
(wiki syntax)
Show/hide line numbers
encoder.h
00001 /* 00002 #ifndef ENCODER_H 00003 #define ENCODER_H 00004 #include "mbed.h" 00005 00006 00007 void resetEncoders(); 00008 00009 int getEncoderDistance(); 00010 00011 00012 class Encoder { 00013 public: 00014 volatile int pulses; 00015 00016 Encoder(PinName channelA, PinName channelB); 00017 00018 //Reset the encoder 00019 void reset(void); 00020 00021 //Gets pulses by directly querying the encoder. 00022 operator int() { 00023 return pulses; 00024 } 00025 00026 private: 00027 InterruptIn channelA_; 00028 InterruptIn channelB_; 00029 int prevState_; 00030 int currState_; 00031 00032 void encode(void); 00033 }; 00034 */ 00035 00036 extern Encoder leftEncoder; 00037 00038 00039 #endif
Generated on Sun Sep 11 2022 08:09:41 by 1.7.2