Arduino Uno wheels with motors programming

In my class we are trying to have the robot’s wheels to accelerate to max speed and then decelerate and stop and then do the same backwards. Our hard wiring is right so we have some problem with the code. Thank you in advance if you can find where we went wrong, im not very good at coding yet so it’s much appreciated!

#include <avr/io.h>
#include <avr/interrupt.h>

double right_speed;
double left_speed;
double other_speed;
double counter = 0;
double global_timer = 0;

void initialize_timer(void)
{
TCCR1B = 2; //increment timer at 2MHz
TIMSK1 |= (1 << OCIE1A); //enable output compare match
sei(); //enable global interrupts
}

void set_motor_speed(int motor_number, int speed) //turns on motor and sets timer
{
if(motor_number == 0)
right_speed = speed;

if(motor_number == 1)
left_speed = speed;

if(motor_number == 2)
other_speed = speed;
}

ISR(TIMER1_COMPA_vect)
{
if (counter == 0)
PORTD |= 1 << PD6;

if (counter == (1.5 - (right_speed * .005)))
PORTD &= ~(1 << PD6);

if (counter == 5)
PORTD |= 1 << PD7;

if (counter == (6.5 - (left_speed * .005)))
PORTD &= ~(1 << PD7);

if (counter == 20)
{
counter = 0;
global_timer += .002;
}

counter += .1;
OCR1A += 200;
}

int main(void)
{
int set_speed = 0;
double t = 0;

DDRD |= 1 << PD6;
DDRD |= 1 << PD7;

initialize_timer();

while(1)
{
if (global_timer == t)
{
t += .5;

if (t <= 2.5)
set_speed += 20;

if ((t > 2.5) && (t <= 5))
set_speed -= 20;

if ((t > 5) && (t <= 7.5))
set_speed -=20;

if ((t > 7.5) && (t < 10))
set_speed += 20;

if (t == 10)
set_speed = 0;

set_motor_speed(0, set_speed);
set_motor_speed(1, set_speed);
}
}
return 0;
}