Zu dem Auslesen der Strecke hab ich was in der Lib.c gefunden:
Ich denke, das müsste es sein, oder? Dann kann ich einfach zu Beginn eines Fahr-Vorgangs mleft_dist und mright_dist auf Null setzen und danach auslesen, ins Array schreiben und Koordinaten berechnen?!?!?!Code:/*****************************************************************************/ // Encoders // Timing variable used for speed calculation: volatile uint8_t speed_timer; // Speed measurement variables volatile uint16_t mleft_counter; volatile uint16_t mright_counter; volatile uint16_t mleft_speed; volatile uint16_t mright_speed; // Distance volatile uint16_t mleft_dist; volatile uint16_t mright_dist; // This is only used for the selftest program. // You don't need this for your own programs! #ifdef DEBUG_MEASURE_DUTY_CYCLE volatile uint16_t cycle_h_l; volatile uint16_t cycle_l_l; volatile uint16_t cycle_h_r; volatile uint16_t cycle_l_r; volatile uint8_t cycle_h_l_tmp; volatile uint8_t cycle_l_l_tmp; volatile uint8_t cycle_h_r_tmp; volatile uint8_t cycle_l_r_tmp; #endif /** * External Interrupt 0 ISR * (ENCL) * */ ISR (INT0_vect) { mleft_dist++; mleft_counter++; // Only used for selftest program: #ifdef DEBUG_MEASURE_DUTY_CYCLE if(isEncoderLeft()) { cycle_l_l = cycle_l_l_tmp; cycle_l_l_tmp = 0; } else { cycle_h_l = cycle_h_l_tmp; cycle_h_l_tmp = 0; } #endif }
MfG
Lesezeichen