Micros() returning bad data in interrupt
i'm developing code motor controller we've constructed scratch. in order motor controller operate correctly, need calculate realtime velocity of motor. done recording time between ticks of encoders. during operation, velocity seems on place. narrowed down issue times being returned micros() function in interrupt being triggered encoders. in effort debug, created following code output of times being recorded when interrupt fired. code: [select] #define max_power 255 // // pin definitions // #define encoder_a 2 #define encoder_b 3 #define motor_current_1 a0 #define motor_current_2 a1 #define motor_voltage a2 #define motor_direction 10 #define motor_pwm 11 #define motor_fault 12 #define motor_enable 13 // // buffer // volatile uint16_t = 0; const uint16_t max_records = 200; volatile unsigned long time[max_records]; void setup(){ serial.begin(115200); // pin setup pinmode(motor_dir...