Controlling DC motor attached with smell sensor.

There is a robot which moves forward, backward, right, left using motor driver sheild program. Now i've attached a dc motor with smell sensor. The DC motor takes time T for full rotation. I want the dc motor to run for time T1 and during that time the values from smell sensor will be taken into in an array. Based on the values from array the robot takes certain direction(such as right,left,..). At the starting of time T2, the robot should move in certain direction based on the values in an array obtained in T1 duration. Like this there are 4 time slots. such as T=T1+T2+T3+T4

How to write the program for this????

Study the "blink without delay" example that comes with the Arduino IDE. It will give you some ideas for doing time-based measurements.