Пример #1
0
def GoPressed(pin):
    global time_stamp       # put in to debounce
    global debounce
    global PoweredOff
    global Scanning
    global Going
    global commandString

    time_now = time.time()
    if (time_now - time_stamp) >= debounce and PoweredOff==False and Scanning==False and Going==False:
        Going = True
        print("Go Button pressed")
        if (bFoundQR == True and commandString != ""):
            # Play a sound to show that we are scanning
            audio.playSound(10) # play start sound

            arduinoComms.parseCommandString(commandString)

            # Play sound that we found one
            audio.playSound(10)

            # Success GO operation, turn LED off and flag QR found as FALSE for next go
            GPIO.output(ledPinFoundQR, False)
            bFoundQR = False
            # Pass command to motor controller here
        else:
            print("No QR Found, scan again please")
        Going = False
    time_stamp = time_now