Commit 12f1254a authored by mattdr's avatar mattdr
Browse files

started working on the speed timer

parent d50c9956
......@@ -26,7 +26,8 @@ int hard_coded_offset = -1051;
// the wheel
int calibration_delay = 1000;
// Timer setup (for speed calc)
IntervalTimer speed_timer;
//forward declarations
void isr_index(void);
......@@ -63,9 +64,28 @@ void encoder_setup(void)
//xPosn.zeroFTM(); //This zeros the counter
//setup the speed timer to run ever 1 sec
speed_timer.begin(print_speed_ISR, 100000);
delay(5000); //sit tight for a bit
}
// Interrupt that is used to print out speed every so often
//NOT DONE
void print_speed_ISR(void){
static int last_count = 0;
volatile int raw_count = 0;
cli();
raw_count = encoder.calcPosn();
sei();
int count_diff = raw_count - last_count;
last_count = raw_count;
}
int wrap_wheel_tics(int in_position)
{
int mod_position = in_position % total_encoder_ticks;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment