title: running a command when a button is pressed on a raspberry pi not working
body: <p>I thought i had it correct but i must be doing something wrong. </p>
  
  <p>What i want to happen is when i press the button the first time its sets the override_set to true and then runs the command for the stepper motor and then prints on the screen that the override is enabled. when you press the button again it runs the stepper motor in forward and then sets the override_set to false. </p>
  
  <p><a href="https://paste.pythondiscord.com/rivaxepoxa.py" rel="nofollow noreferrer">https://paste.pythondiscord.com/rivaxepoxa.py</a></p>
  
  <pre class="lang-py prettyprint-override"><code>override_set = False
  
  #setting button stuff up
  def override (channel):
      global override_set
      global kit
      global gate_open
      override_set = not override_set
      if overide_set == True:
              cv2.putText(frame,'Overide Enabled',(int(IM_WIDTH*.1),int(IM_HEIGHT*.5)),font,3,(0,0,0),7,cv2.LINE_AA)
      if override_set:
          for i in range(200):
              kit.stepper1.onestep(direction=stepper.BACKWARD,style=stepper.MICROSTEP)
          gate_open = True
      else:
          for i in range(200):
                  kit.stepper1.onestep(direction=stepper.FORWARD,style=stepper.MICROSTEP)
          gate_open = False
  GPIO.setmode(GPIO.BCM)
  
  GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.add_event_detect(18, GPIO.FALLING, callback=override, bouncetime=300)
  
  
    [1]: https://paste.pythondiscord.com/rivaxepoxa.py
  </code></pre>