// A variable to set a delay time between each LED
int delayTime = 10;
// A variable to store which LED we are currently working on
int currentLED = 4;
// A variable to store the direction of travel
int dir = 1;
// A variable to store the last time we changed something
long timeChanged = 0;
//...