wecodewithmichaelmccloskey / Smart_Breadboard

MIT License
1 stars 0 forks source link

Application Layer Function for Touchscreen and Buttons #43

Open wecodewithmichaelmccloskey opened 1 year ago

wecodewithmichaelmccloskey commented 1 year ago

Create application layer for in-hand product

wecodewithmichaelmccloskey commented 1 year ago

Getting an error when using multiple GPIO.wait_for_edge() functions:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
middle button pressed
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.9/threading.py", line 892, in run
middle button pressed
    self._target(*self._args, **self._kwargs)
middle button pressed
  File "/home/pi/Smart_Breadboard/app.py", line 34, in rightButtonPress
    sbb.readRightButton()
  File "/home/pi/Smart_Breadboard/app.py", line 28, in leftButtonPress
    sbb.readLeftButton()
  File "/home/pi/Smart_Breadboard/Smart_Breadboard.py", line 222, in readLeftButton
    GPIO.wait_for_edge(left_button_pin, GPIO.FALLING)
middle button pressed
RuntimeError: Error waiting for edge
  File "/home/pi/Smart_Breadboard/Smart_Breadboard.py", line 225, in readRightButton
    GPIO.wait_for_edge(right_button_pin, GPIO.FALLING)
RuntimeError: Error waiting for edge

This error does not occur when only using 1. I can accurately detect when 1 button is pressed if the other 2 are simulated as timers (not using GPIO.wait_for_edge)