I need to put a button in my arduino that will pause all code until the button is pressed.
I need to not let the pin in the loop turn on, until a switch is pressed. After that, the switch doesn't matter at all.
Here is my code:
int pin = 9;
int ledPin = 13;
volatile int state = LOW;
volatile int Count = 0;
volatile int Dists = 65;
pinMode(ledPin, OUTPUT); // sets the digital pin as output
attachInterrupt(1, Dist, FALLING);
if (Count >= Dists)
digitalWrite(ledPin, HIGH); // sets the LED on