CrossRoads:
Compiler tells you the problems.switchpin is not the same as switchPin.. C++ is case sensitive.
byte run; is missing
You're missing a } at the end.
Thank you, I didn't have my screen setup properly to see that.
I have reverted to a simpler code shown below. It does not revert back to "OFF" after the timer, where am I going wrong here?
int ledPin = A5;
int switchPin = A0;
boolean lastButton = LOW;
boolean currentButton = LOW;
int switch2Pin = A1;
boolean last2Button = LOW;
boolean current2Button = LOW;
void setup ()
{
pinMode(ledPin, OUTPUT);
pinMode(switchPin, INPUT);
pinMode(switch2Pin, INPUT);
}
boolean debounce(boolean last)
{
boolean current = digitalRead(switchPin);
if (last != current)
{
(delay(5));
}
return current;
}
boolean debounce2(boolean last2)
{
boolean current2 = digitalRead(switch2Pin);
if (last2 != current2)
{
(delay(5));
}
return current2;
}
void loop ()
{
current2Button = debounce2(last2Button);
if (last2Button == LOW && current2Button == HIGH)
{
/*
* Here is where the static flow is. currently set to
* 10 seconds of on time. This will need changed for
* different flow rate injectors so you dont overfill
* your graduated cylinders.
*/
delay(500);
digitalWrite(ledPin, HIGH);
delay(2000);
digitalWrite(ledPin, LOW);
}
}