Peristaltic Pump + Stepper Motor

Hello i want to drive a peristaltic pump with a stepper motor , its for glueing so i press the switch and a amount of glue comes out of the tube. But i want to turn te motor a x steps back to prevent dripping. It must look like this but it is not working.
Can some body help me..

define DISTANCE1 1000
define DISTANCE2 200
int StepCounter = 0;
int Stepping = false;

void setup() {
pinMode(8, OUTPUT); //Direction
pinMode(9, OUTPUT); //steps
digitalWrite(8, LOW);
digitalWrite(9, LOW);

pinMode(3,INPUT);
}

void loop() {
if (digitalRead(3) == LOW && Stepping == false)
{
Stepping = true;
}

if (Stepping == true)
{
digitalWrite(9, HIGH);
delay(1);
digitalWrite(9, LOW);
delay(1);

StepCounter = StepCounter + 1;

if (StepCounter == DISTANCE1)
{
StepCounter = 0;
{
digitalWrite(8, HIGH)// turn contra clock wise
{
digitalWrite(9, HIGH);
delay(1);
digitalWrite(9, LOW);
delay(1);
StepCounter = StepCounter + 1;

if (StepCounter == DISTANCE2)
{
StepCounter = 0;
Stepping is false
}
}
}

@Andre71, start your own thread, don't hijack an existing one.

But first, read this thread on how to post your code: Read this before posting a programming question

As the topic says, you should have read that BEFOREposting.

Can some body help me..

What does that code actually do? How does that differ from what you want?

You should look at the state change detection example. Learn to determine when a switch has BECOME pressed, not when the switch IS pressed.

Why should we have to guess what is connected to pins 3 and 9, and how?

Why does
your code
look like
it was typed
by a drunken
monkey?

Use Tools + Auto Format, BEFORE posting code.

It does NOT make sense to compare the number of steps taken to a distance.

Get { rid { of { all { the } useless } curly } braces. Not the useful ones, just the useless ones. Of course that means that you need to know the difference.

If the Arduino isn't going to be doing anything else while the stepper is stepping forwards and backwards, use two for loops to step forward and backwards.