Project design

Hey there!

I've been trying to create a code for a project, but i have an extremely big issue. My project requires to control an AC motor, i need to use 2 sensors and a starting button. When I try the code alone it seems to work but as soon as i connec the Variable frequency drive thar i need to use it stops working, I am using a relay module in order t ocontrol the Variable frequency drive. Does anyone have an idea of what is going on? this is the code i am using:

int BUTTON_PIN1=8;
int BUTTON_PIN2=9;
int BUTTON_PIN3=10;
int buttonState1=0;
int buttonState2=0;
int buttonState3=0;
const int Forward = 2;
const int Backward = 5;
int counter=0;
int start=0;
void setup() {
pinMode(BUTTON_PIN1, INPUT);
pinMode(BUTTON_PIN2, INPUT);
pinMode(BUTTON_PIN3, INPUT);
Serial.begin(9600);
pinMode(Forward , OUTPUT);
pinMode(Backward , OUTPUT);
}

void loop() {
buttonState1=digitalRead(BUTTON_PIN1);
buttonState2=digitalRead(BUTTON_PIN2);
buttonState3=digitalRead(BUTTON_PIN3);
if (buttonState3==1)
{
(start=1);
delay(50);
}
if (buttonState1==1)
{
if (start==1)
{
(counter=1);
delay(50);
}
if (counter==0)
{
digitalWrite(Backward , HIGH);
delay(50);
digitalWrite(Forward , HIGH);
delay(50);
}
}
if (counter==1)
{
digitalWrite(Forward , LOW);
delay(50);
digitalWrite(Backward , HIGH);
delay(50);
if (buttonState2==1)
{
(counter=2);
delay(5);
(start=0);
delay(50);
}
}
if (counter==2)
{
digitalWrite(Backward , LOW);
delay(5);
digitalWrite(Forward , HIGH);
delay(5);
}
if (buttonState1==1);
(counter=0);

Serial.println(counter);
}

Please read the "How to use this forum - please read" sticky at the top of any of the boards on this forum. Please pay particular attention to the part about how to post code.

You should also consider adding any additional details that might be needed for someone to try to troubleshoot your issue. I would think that the hardware details and wiring would probably be pretty important there, wouldn't you? Please post links to the drive and a schematic of how you have things wired. Just a hand drawn schematic will be fine, please don't use the Fritzing program to draw a tangle of colored lines that nobody can figure out and expect that it will help.

If you are using only one relay, what does "forward" and "backward" do?

Paul