adafruit / adafruit/Adafruit_CircuitPython_seesaw
seesaw digitalio not setting pullups properly
- Dominant language
- Python
- Stars
- 68
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
The following code should work.
```
import time
import board
from adafruit_seesaw import seesaw, digitalio
ss = seesaw.Seesaw(board.I2C())
button = digitalio.DigitalIO(ss, 0)
button.switch_to_input(pull=ss.INPUT_PULLUP)
while True:
print(button.value)
time.sleep(0.2)
```
However, it does not. The pin is left floating. The following code, _does_ work.
```
import time
import board
import digitalio
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.digitalio import DigitalIO
ss = Seesaw(board.I2C())
button = DigitalIO(ss, 0)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP
while True:
print(button.value)
time.sleep(0.2)
```
Presumably the first example is supposed to work like the second example, but it does not. I have no suggestions on where to start with fixing this.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the adafruit_seesaw.digitalio.DigitalIO switch_to_input entry point and compare it with the direction and pull property setters used in the working example. Reproduce the first example with the seesaw DigitalIO API, then confirm that setting INPUT_PULLUP results in the same pull-up behavior as the separate direction and pull assignments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100