Using start and stop button.

I'm working on a project with 2 seperate pushbuttons, a start and a stop. I have managed to program the start function correctly, but the stop button won't work. I think this must be programmed the same way (state=false)? I hope there is a solution to this.

The code:
const int Start = 8;
const int Stop = 9;
const int Relais = 7;
const int Button3 = 6;
int Interval = 2000;
int Startstate = 0;
int Stopstate = 0;
boolean Blinkstate = false;
// Integers and Booleans. (don't mind Button 3, it's for a future expansion.

void setup() {
// Set inputs & outputs.
pinMode(Start, INPUT);
pinMode(Stop, INPUT);
pinMode(Relais, OUTPUT);
pinMode(Button3, INPUT);
}

void loop() {
// Read the state of the pushbutton values:
Startstate = digitalRead(Start);
Stopstate = digitalRead(Stop);

// check if the start button is pressed. If it is, the startstate is HIGH:
if (Startstate == HIGH && Stopstate == LOW ) {
Blinkstate = true;
} // set blinkstate active

// check if the start button is pressed. If it is, the stopstate is HIGH:
if (Stopstate == HIGH && Startstate == LOW) {
Blinkstate = false;
} // set blinkstate non-active

while (Blinkstate == true)
blinkFunction(); // when Blinkstate is true, perform the blinkFunction.
}

void blinkFunction() { // Blinkfunction void.
digitalWrite(Relais, HIGH);
delay (1000);
digitalWrite(Relais, LOW);
delay (1000);
}

Interval_test.ino (1.15 KB)

while (Blinkstate == true)
blinkFunction(); // when Blinkstate is true, perform the blinkFunction.

Once it enters this while loop, how will it ever exit. How can the state of Blinkstate change? If it is stuck in that loop, Blinkstate cannot be read.

And with those delays the program will never be very responsive. You have to wait for the delays to expire before you can read the switches. Better to learn to write non blocking code using millis() or micros for timing.
Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

How are the switches wired? Are there pulldown resistors on those pins?

Please read the advice given in the first topics telling how to use Forum, how to post questions, code etc.

Attach a wiring diagram. There are possibilities that the combination of how the buttons are connected and the code will cause malfunction.

When the execution enters blinkFunction, how do You think it will end and execution return to loop?

It might be better to have a variable called runState and use the buttons to change it from true to false - something like

prevStartBtnState = startButtonState;
prevStopBtnState = stopButtonState;

startButtonState = digitalRead(startButtonPin);
stopButtonState = digitalRead(stopButtonPin);

if (startButtonState == LOW and prevStartBtnState == HIGH) { // assumes LOW when pressed
  runState = true;
}
if (stopButtonState == LOW and prevStopBtnState == HIGH) {
  runState = false;
}

if (runState == true) {
   // do stuff
}

...R