push button and limit switch

Hi,
ı made a project with push button,limit swwitches and dc motors.I want to start calibration process when first push button pressed and stop calibration process first push putton press secondly. But when i pressed first push button serial monitor didnt write "calibration start".

if(kalibrasyonState == HIGH && lastkalibrasyonState == LOW){
 Serial.println("calibrasyon start");
 vanapositioncontrol();
 int vanarole2State = digitalRead(vanarole2);
 if(vanarole2State==HIGH){
     Serial.println("vana pozsiyon kontrol edildi");
   tartipositioncontrol();
}
int tartirole1State = digitalRead(tartirole1);
   if(tartirole1==HIGH){
 Serial.println("tartı pozsiyon kontrol edildi");
     calibration();
     Serial.println("kalibrasyon tamamlandı");
     }
     }
     lastkalibrasyonState=kalibrasyonState;

Full code of project is here.

#include <HX711.h>
#include <TM1637Display.h>
#include "DualMC33926MotorShield.h"
#include "Wire.h"
#include <Keypad.h>
HX711 scale(A2, A3);
int paketboyutu = 0;
int a=0;
int b=0;
int c=0;
//int kalibrasyonState = 0;
int lastkalibrasyonState = LOW;
//int processState = 0; 
int lastprocessState = LOW;
//int vanarole1State = 0; 
//int vanarole2State = 0; 
//int tartirole1State = 0; 
//int tartirole2State = 0; 
const byte ROWS = 4;
const byte COLS = 3;
const int kalibrasyon = 3;
const int process = 2;
const int vanarole1 = 14;
const int vanarole2 = 15;
const int tartirole1 = 5;
const int tartirole2 = 4;
//const int CLK = 5;
//const int DIO = 4;
char keys[ROWS][COLS] = {
    {'1','2','3'},
    {'4','5','6'},
    {'7','8','9'},
    {'*','0','#'}
};
byte rowPins[ROWS] = {11, 6, 7, 9};
byte colPins[COLS] = {10, 12, 8};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
DualMC33926MotorShield Motors;
//TM1637Display display(CLK, DIO);
void setup() {
  Serial.begin(9600);
  // display.setBrightness(0x0a);
    Motors.init();
//    paketboyutu = GetNumber();
//    Serial.println(paketboyutu);
  pinMode(kalibrasyon, INPUT);
   pinMode(process, INPUT);
     pinMode(vanarole1, INPUT);
       pinMode(vanarole2, INPUT);
         pinMode(tartirole1, INPUT);
           pinMode(tartirole2, INPUT);
         
             
 }
void loop() {
int kalibrasyonState = digitalRead(kalibrasyon);
//int processState = digitalRead(process);
//int vanarole1State = digitalRead(vanarole1);
//int vanarole2State = digitalRead(vanarole2);
//int tartirole1State = digitalRead(tartirole1);
//int tartirole2State = digitalRead(tartirole2);

if(kalibrasyonState == HIGH && lastkalibrasyonState == LOW){
 if(kalibrasyonState == HIGH ){
   kalibrasyonState=LOW;
   }
   else{
     kalibrasyonState=HIGH;
Serial.println("kalibrasyon başladı");
 vanapositioncontrol();
 int vanarole2State = digitalRead(vanarole2);
 if(vanarole2State==HIGH){
     Serial.println("vana pozsiyon kontrol edildi");
   tartipositioncontrol();
}
int tartirole1State = digitalRead(tartirole1);
   if(tartirole1==HIGH){
 Serial.println("tartı pozsiyon kontrol edildi");
     calibration();
     Serial.println("kalibrasyon tamamlandı");
     }
     }
     lastkalibrasyonState=kalibrasyonState;
     paketboyutu = GetNumber();
     Serial.print("paketboyutu:");
     Serial.println(paketboyutu);
     double weight=scale.get_units(10);
     Serial.print("paketboyutu:");
     Serial.println(paketboyutu);
    // display.showNumberDec(weight);
    int processState = digitalRead(process);
     if(lastprocessState  == HIGH && processState  == LOW){
       Serial.print("PROCESS BAŞLADI");
       while(weight<paketboyutu){  //İF Mİ WHİLE MI??
         vanageri();  //vana açılacak
         }
         vanapositioncontrol();
         int vanarole2State = digitalRead(vanarole2);
        if(vanarole2State==HIGH){
         menteseac120();
         tartipositioncontrol();
       }
       }
       lastprocessState=processState;
       }
}
void  calibration(){
 scale.power_down();        // put the ADC in sleep mode
 delay(2000);
 scale.power_up();
scale.set_scale(2280.f);                     
 scale.tare();
}
void  menteseac(){
 Motors.setM1Speed(400);
}
void  mentesekapa(){
 Motors.setM1Speed(-400);
}
void  menteseac120(){
 Motors.setM1Speed(200);
}
void  vanaileri(){
 Motors.setM1Speed(400);
}
void  vanageri(){
 Motors.setM1Speed(-400);
}
void  vanapositioncontrol(){
int vanarole2State = digitalRead(vanarole2);
while(vanarole2State==LOW){
vanaileri();
//vanarole2State = digitalRead(vanarole2)
}
}
void   tartipositioncontrol(){
int tartirole1State = digitalRead(tartirole1);
int tartirole2State = digitalRead(tartirole2);
while(scale.get_units(10)!=0){  //tartının üzerinde malzeme varsa
 menteseac120();
 }
 if(scale.get_units(10)==0){    //nerde kapanacağı önemli
 while(tartirole1==LOW){  //menteşe kapalı pozşsyonda olmayabilir
   mentesekapa();
   }
   }
if(tartirole2==HIGH){
  for(int i=0;i<1;i++){
    while(tartirole2==LOW){
      menteseac();  //buraya da sayı gelebilir karışabilir
      }
      while(tartirole1==LOW){
        mentesekapa();
        }
 }
}
}
int GetNumber()
    {
    int num = 0;
    char key = keypad.getKey();
    while(key != '#')
    {
    switch (key)
    {
    case NO_KEY:
    break;
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
    num = num * 10 + (key - '0');
    break;
    case '*':
    num = 0;
    break;
    }
    key =keypad.getKey();
    }
    return num;
    }

Please, open this link and scroll down to the #7:

http://forum.arduino.cc/index.php/topic,148850.0.html

(Put your code under code brackets)

  pinMode(kalibrasyon, INPUT);
   pinMode(process, INPUT);
     pinMode(vanarole1, INPUT);
       pinMode(vanarole2, INPUT);
         pinMode(tartirole1, INPUT);
           pinMode(tartirole2, INPUT);

Is
there
something
wrong
with
your
tab
key?

How IS your switch wired?

one of leg of button connect to 5v other leg is connected to arduino pin and ground with 10 k resistor

const int button2Pin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
int ledState = LOW;         // the current state of the output pin
int lastButtonState = LOW;   // the previous reading from the input pin
void setup() {
 pinMode(button2Pin, INPUT);
 pinMode(ledPin, OUTPUT);
}
void loop() {
int reading = digitalRead(button2Pin);
if (lastButtonState == LOW && reading == HIGH)
{
if (ledState == HIGH) 
{
ledState = LOW;}

else {
 ledState = HIGH;
}
digitalWrite(ledPin, ledState);
}
lastButtonState = reading;
}

this code is working with my button wiring and button act as a switch but similar code and wiring in above didnt work

one of leg of button connect to 5v other leg is connected to arduino pin and ground with 10 k resistor

This conveys so little information as to be nearly useless.

Wiring a switch using the internal pullup resistor is so much simpler. One leg to ground. The other leg to a digital pin. No ambiguity. HIGH means not pressed; LOW means pressed. After you enable the internal pullup resistor, anyway.

I don't speak the same language but I used ctrl+t and notice some interesting open and closing switchs in the real program

I have made notes in the program section that may assist

 if (kalibrasyonState == HIGH && lastkalibrasyonState == LOW) {//open if
    if (kalibrasyonState == HIGH ) {
      kalibrasyonState = LOW;
    }//nope thats a work around because its in a if so it wont do that
    else {
      kalibrasyonState = HIGH;
      Serial.println("kalibrasyon başladı");
      vanapositioncontrol();
      int vanarole2State = digitalRead(vanarole2);
      if (vanarole2State == HIGH) {
        Serial.println("vana pozsiyon kontrol edildi");
        tartipositioncontrol();
      }
      int tartirole1State = digitalRead(tartirole1);
      if (tartirole1 == HIGH) {
        Serial.println("tartı pozsiyon kontrol edildi");
        calibration();
        Serial.println("kalibrasyon tamamlandı");
      }
    }//close  else 
    lastkalibrasyonState = kalibrasyonState;//what am i doing here
    //i can block the code on the first pass then im blocking this line
    //from ever reseting as lastkalibrasyonState will never go low
    
    paketboyutu = GetNumber();
    Serial.print("paketboyutu:");
    Serial.println(paketboyutu);
    double weight = scale.get_units(10);
    Serial.print("paketboyutu:");
    Serial.println(paketboyutu);
    // display.showNumberDec(weight);
    int processState = digitalRead(process);
    if (lastprocessState  == HIGH && processState  == LOW) {
      Serial.print("PROCESS BAŞLADI");
      while (weight < paketboyutu) { //İF Mİ WHİLE MI??
        vanageri();  //vana açılacak
      }
      vanapositioncontrol();
      int vanarole2State = digitalRead(vanarole2);
      if (vanarole2State == HIGH) {
        menteseac120();
        tartipositioncontrol();
      }
    }
    lastprocessState = processState;

  }//close  if (kalibrasyonState == HIGH && lastkalibrasyonState == LOW)
  
}
//think it should be 
//if (kalibrasyonState == HIGH && lastkalibrasyonState !=kalibrasyonState){
//do this once}

// in main loop after this 
//lastkalibrasyonState = kalibrasyonState;