The above link rotates the motor in each direction for 3 seconds, but my requirement is that the motor should turn slowly 180 degrees clockwise then 180 degrees anti clockwise. This needs to be repeated for a 10 cycles.

Is there any way I can control the motion ? Is it advanced programming required?

In my head I was thinking to stop the motor using the time delay at 180 degrees, is this the way to go on about it?

I can think of two ways to do this and there are probably better ways.

Use a stepper motor. With each step the motor will rotate a fixed amount and then stop. That's a different motor and a different driver.

Use an indexing device, though this is likely to work poorly, but you can use the same motor and the same driver you have now. With this method you attach a disk to the motor's shaft and make hole in it, and then use an optical detector to tell when the disk is in the position in which light passes through the hole. To make the motor run slowly enough to stop right after the hole is in front of the sensor, job the motor will narrow pulses at a low frequency. A lot of experimentation will be required.

Well mainly its a project at work. I have a small motor geared down, I have used it using a DC source, and the motor is operatable at 0.3mA. I want the motor to operate at 0.3mA constant (slow motion), and want to use it so that the motor starts and stops at 180 degrees clockwise motion and then stops and moves back to 0 degrees anticlockwise for 5 times. Hope that explains it.