So, I have code that does not work no matter what. No matter how many times I try, I can't get the 302 error out, but I wrote the entire thing. I tried removing the entire line, three lines and rewrite them, nothing worked: I still have the same 302 stray error on the same exact line. I need help, why is it that my own code has this issue? I do not know for what reason.
Someone suggested I have copied the code, but this is my first time writing code. Why would I copy bad code? My code can't be anything but bad as of now
#include <Servo.h>
Servo LOCK;
int Button1 = 2;
int Button2 = 3;
int Button3 = 4;
int ButtonPressed1 = 0;
int ButtonPressed2 = 0;
int ButtonPressed3 = 0;
int ButtonPressTime1 = 0;
int ButtonPressTime2 = 0;
int ButtonPressTime3 = 0;
char COMBO = ´´no´´;
char PASSWORD = ´´START, ONE, ONE, TWO, TWO´´;
int LOCKED = 1;
void setup() {
LOCK.attach(5);
pinMode(Button1, INPUT);
pinMode(Button2, INPUT);
pinMode(Button3, INPUT);
}
void loop() {
ButtonPressed1 = digitalRead(Button1);
ButtonPressed2 = digitalRead(Button2);
ButtonPressed3 = digitalRead(Button3);
while (ButtonPressed1 == HIGH) {
++ButtonPressTime1;
delay(1);
};
if (ButtonPressed1 == LOW) {
ButtonPressTime1 = 0;
};
while (ButtonPressed2 == HIGH) {
++ButtonPressTime2;
delay(1);
};
if (ButtonPressed2 == LOW) {
ButtonPressTime2 = 0;
};
while (ButtonPressed3 == HIGH) {
++ButtonPressTime3;
delay(1);
};
if (ButtonPressed3 == LOW) {
ButtonPressTime3 = 0;
};
if (ButtonPressTime1 >= 1000) {
COMBO = COMBO + ´´, ONE´´;
if (COMBO == PASSWORD) {
LOCK.write(180);
LOCKED = 0;
} else {
LOCK.write(0);
LOCKED = 1;
}
};
if (ButtonPressTime2 >= 2000) {
COMBO = COMBO + ´´, TWO´´; //this line has the issue
if (COMBO == PASSWORD) {
LOCK.write(180);
LOCKED = 0;
} else {
LOCK.write(0);
LOCKED = 1;
}
};
if (ButtonPressTime3 >= 3000) {
COMBO = 0;
if (LOCKED = 0) {
LOCK.write(180);
LOCKED = 1;
} else {
LOCK.write(0);
}
}
}