A quick and dirty using your existing code would be to map your speed to a variable in the delay statement.
Example:
If full speed is 100ms delay then half speed might be 200ms.
double speed = 1 // 1, .75, .5, .4, .25
uint32_t speed_delay = (1 / speed)
delay (speed_delay)