Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Inital Setups
- global forklift_count
- global person_count
- global barrier_remote_pressed_a
- global barrier_remote_pressed_b
- global tsA_signal
- global tsB_signal
- forklift_count = 0
- person_count = 0
- barrier_remote_pressed_a = False
- barrier_remote_pressed_b = False
- GPIO.output(8, 1)
- GPIO.output(10, 1)
- GPIO.output(12, 1)
- GPIO.output(16, 1)
- GPIO.output(18, 1)
- GPIO.output(22, 1)
- while True:
- # Input buttons and sensors
- # omitted unnecessary inputs from Stackoverflow example
- tsB_signal = GPIO.input(37)
- tsA_signal = GPIO.input(38)
- # Turnstile B Entry Pressed
- if tsB_entry_button == False:
- triggered = False
- if check_forklift_count() == 0:
- timeout1 = time.time() + 20
- while True:
- if time.time() > timeout1:
- print("turnstile not activated in time")
- break
- if triggered == False:
- GPIO.output(18, 0)
- time.sleep(2)
- GPIO.output(18, 1)
- print("Turnstile B - Triggered Enter Warehouse")
- triggered = True
- if tsB_signal == False: # Never executes even when signal sent
- print("Signal received")
- person_count += 1
- print("Person Count = %s" % check_person_count())
- break
- else:
- print("Turnstile B - There are forklifts %s in the warehouse or there are forklifts entering the warehouse" % check_forklift_count())
- break
- # Never goes false so never runs
- if tsB_signal == False: # Never executes even when signal sent
- print("Signal received")
- person_count += 1
- print("Person Count = %s" % check_person_count())
- break
- # Goes false without issue when signal sent prints that it has been received
- if tsB_signal == False:
- print("Signal Received")
- sleep(0.2)
Add Comment
Please, Sign In to add comment