Problem with a project

Hello Everyone!!

I am making a sketch for a machine to replace its old electrical panel.

int plus = A5;
int ls_1 = A1;
int ls_2 = A2;
int ls_3 = A3;
int ls_4 = A4;
int minus = A0;
int on_left = 6;
int on_right = 7;
int sen_sw = 8;
int hyd = 5;
int cut_mot = 10;
int jb_1 = 11;
int jb_2 = 12;
int strt = 13;

void setup() {
// put your setup code here, to run once:

pinMode(strt, INPUT);
pinMode(ls_1, INPUT);
pinMode(ls_2, INPUT);
pinMode(ls_3, INPUT);
pinMode(ls_4, INPUT);
pinMode(on_left, INPUT);
pinMode(on_right, INPUT);
pinMode(sen_sw, INPUT);
pinMode(hyd, OUTPUT);
pinMode(cut_mot, OUTPUT);
pinMode(jb_1, OUTPUT);
pinMode(jb_2, OUTPUT);

}

void loop() {
int btn = 0;
int left = 0;
int ls1 = 0;
int ls2 = 0;
int ls4 = 0;
int sen = 0;
int right = 0;
int ls3 = 0;

if (digitalRead(strt) == HIGH) {

digitalWrite(hyd, HIGH);
}

int hyd_on = digitalRead(hyd);
left = digitalRead(on_left); /6/
ls2 = digitalRead(ls_2); /A2/
ls4 = digitalRead(ls_4); /A4/
sen = digitalRead(sen_sw);
right = digitalRead(on_right);
ls3 = digitalRead(ls_3);
ls1 = digitalRead(ls_1);

if ((ls2 == LOW) && (left == HIGH) && (ls4 == HIGH)) {

digitalWrite(cut_mot, HIGH);
digitalWrite(jb_1, HIGH);
}
else {
digitalWrite(cut_mot, LOW);
digitalWrite(jb_1, LOW);
}

if ((ls1 == HIGH) && (right == HIGH) && (ls3 == LOW)) {

digitalWrite(cut_mot, HIGH);
digitalWrite(jb_2, HIGH);
}
else {
digitalWrite(cut_mot, LOW);
digitalWrite(jb_2, LOW);
}

}

the problem i am facing is when i upload and run this program, every thing runs fine but the output pin **(highlighted **area) has an output of 2-2.5 v (and sometimes even less). But the same pin in the next "if else" (Italic fonts) statement works absolutely fine.
What could be the problem??

all inputs are push buttons and are wired properly with pull-up resisters..

Without seeing the circuit diagram it will be difficult to diagnose. Make a simple pencil drawing showing all the connections and post a photo of the drawing. See this Simple Image Guide

If you can post links to datasheets for the non-Arduino parts it will also help.

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

…R

You write: "the problem i am facing is when i upload and run this program, every thing runs fine but the output pin (highlighted area) has an output of 2-2.5 v (and sometimes even less). But the same pin in the next "if else" (Italic fonts) statement works absolutely fine.".

How often is your program changing the pin? You cannot measure the voltage on a pin if it is constantly being changed from 0 to 5 volts and back to 0 without using an oscilloscope. Bet you are using a DVM.

Paul

welcome.
first step:

read how to use this forum

read about how to write a subject line.

come back, on the bottom right of your first post is the more/modify button

step 2, fix the code by adding "code tags" as explained in step 7 of the link