E2 auto transmission help needed

Alrght I am working on a e2 auto transmission that works on a timer so when I click the go button the car starts driving and after I hut about 15 seconds in first gear it switches but the problem I am having is when I let go w I want the timer to decrease but not reset at 0
I am so far using if statement which is if (w) {time = time - 1} if (time =15) {gear = 2}

Soooo help

Bump

dont use timers use an rpm calculater or speedomiter
cause if it goes up hills then its livly to gear to soon and then it wouldn’t acelerate(trust me im trying to make a 1994 honda acord)


if (~W & !W) { time = 0 }

IF [W has changed] AND [NOT W] THEN time = 0