Hello,
I am pretty new on Arduino coding. I created the following code foe a 3 stores elevator
The idea is that once pushed the botton the motor will rotate in one or the other direction based on the position of the elevator to get to the floor.
I am getting the following error message:
[collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.]
Any help/ suggestion would be appreciated
[
int potPin = 0;
int Button1 = 1;
int Button2 = 2;
int Button3 = 3;
int Switch1 = 4;
int Switch2 = 5;
int Switch3 = 6;
int Led1 = 7;
int Led2 = 8;
int Led3 = 9;
int L2 = 10;
int L1 = 11;
int St = 12;
int FLOOR;
int Busy;
void setup() {
pinMode(Button1, INPUT); // Button 1st floor
pinMode(Button2, INPUT); // Button 2nd floor
pinMode(Button3, INPUT); // Button 3rd floor
pinMode(Switch1, INPUT); // position swith Elevator 1st floor
pinMode(Switch2, INPUT); // position swith Elevator 2nd floor
pinMode(Switch3, INPUT); // position swith Elevator 3rd floor
pinMode(Led1, OUTPUT); // led 1st floor
pinMode(Led2, OUTPUT); // led 2nd floor
pinMode(Led3, OUTPUT); // led 3rd floor
pinMode(St, OUTPUT); // Power switches
pinMode(L1, OUTPUT); // Power motor exit 1
pinMode(L2, OUTPUT); // Power motor exit 2
Busy = 0; // internal variable define if the elevator is workind and unable push buttons
FLOOR = 0; // internal variable determine on which floor the elevator is going
}
void loop1() { //1ST FLOOR
if (Busy = 0);
if (Button1 == HIGH);
{
digitalWrite(St, HIGH);
}
if (Switch1 == LOW);
{ analogWrite(Led1, HIGH);
analogWrite(L1, HIGH);
analogWrite(L2, LOW);
Busy = 1;
FLOOR = 1;
}
}
void loop2() { //2ND FLOOR
if (Busy = 0);
if (Button2 == HIGH);
{
digitalWrite(St, HIGH);
}
if ((Switch2 == LOW) and (FLOOR == 1))
{ analogWrite(L1, LOW);
analogWrite(L2, HIGH);
analogWrite(Led2, HIGH);
Busy = 1;
FLOOR = 2;
}
else
{ analogWrite(L1, HIGH);
analogWrite(L2, LOW);
analogWrite(Led2, HIGH);
Busy = 1;
FLOOR = 2;
}
}
void loop3() { //3RD FLOOR
if (Busy = 0);
if (Button3 == HIGH);
{
digitalWrite(St, HIGH);
}
if (Switch3 == LOW);
{ analogWrite(Led3, HIGH);
analogWrite(L1, LOW);
analogWrite(L2, HIGH);
Busy = 1;
FLOOR = 3;
}
}
void loop4 () { //El_stop
if (Busy = 1);
if ((FLOOR == 1) and (Switch1 == HIGH))
{ (St == LOW);
analogWrite(St, LOW);
analogWrite(L1, LOW);
Busy = 0;
FLOOR = 0;
}
else if ((FLOOR == 2) and (Switch2 == HIGH))
{ (St == LOW);
analogWrite(St, LOW);
analogWrite(L1, LOW);
Busy = 0;
FLOOR = 0;
}
else if ((FLOOR == 3) and (Switch3 == HIGH))
{ (St == LOW);
analogWrite(St, LOW);
analogWrite(L1, LOW);
Busy = 0;
FLOOR = 0;
}
}
]