Team repo
Embed:
(wiki syntax)
Show/hide line numbers
pot.h
00001 #ifndef MBED_POT_H 00002 #define MBED_POT_H 00003 00004 #include "QEI.h" 00005 #include "mbed.h" 00006 00007 class Pot { 00008 public: 00009 Pot(PinName _pin, QEI* encoder, float offset); 00010 float get_angle(); 00011 float angle_as_voltage(); 00012 float get_angle_pulse(); 00013 float get_position(); 00014 int position_as_pulse(); 00015 void set_zeros(); 00016 void update(); 00017 00018 float angle; 00019 float position; 00020 float angular_velocity; 00021 float velocity; 00022 void print_test(); 00023 00024 static const float UPDATE_TIME = 0.0001; 00025 00026 00027 private: 00028 AnalogIn pend_angle; 00029 QEI* encoder; 00030 float offset; 00031 00032 //ecnoder conts 00033 static const float TOTAL_PULSES_ON_TRACK = 5700; 00034 static const float TRACK_LENGTH_CM = 400; 00035 static const float CM_PER_PULSE = TRACK_LENGTH_CM/TOTAL_PULSES_ON_TRACK; 00036 00037 //pot const 00038 static const float VOLTAGE_ANGLE_RATIO = 327.76; 00039 00040 //motor const 00041 static const int STEPS_PER_ROTATION = 1024; 00042 00043 00044 }; 00045 00046 #endif
Generated on Sat Jul 16 2022 15:10:49 by
1.7.2