I came across this error while entering codes for a paper vending machine, any help or solutions for this one?
I also attached an image for the error.
Here is the code:
int motor1 = 2;
int motor2 = 3;
int coinPin = 4;
int button1 = 5;
int button2 = 6;
int val;
int coinCount = 0;
int buttonState = 0;
void setup() {
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(coinPin, INPUT);
}
void loop() {
val = digitalRead(coinPin);
if (val == HIGH)
{
coinCount++;
buttonState = digitalRead(button1);
if (buttonState == HIGH && coinCount == 1)
{
digitalWrite(motor1, HIGH);
delay(5000);
digitalWrite(motor1, LOW);
coinCount = 0;
}
else if
{
buttonState = digitalRead(button2);
if (buttonState == HIGH && coinCount == 1)
{
pinMode(motor2, OUTPUT);
digitalWrite(motor2, HIGH);
delay(5000);
digitalWrite(motor2, LOW);
coinCount = 0;
}
}
}
}[left][/left]