I only need the computer to do one thing though lol.
The milli function and tutorial in the link are above my head at the moment.
I'm attempting to accomplish what I want, which is do nothing until the button is pushed, then run the sketch, with an IF statement, but my code is not compiling.
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(digitalRead(switchpin) == LOW) //funcitons based off of button pulling input pin LOW
{
if(run == 0)
{
run = 255;
delay(500);
digitalWrite(ledPin, HIGH);
delay(10000);
digitalWrite(ledPin, LOW);
}
}