-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seesaw_crickit_test.py fails with Invalid touch pin #53
Comments
After further investigation it looks like the real issue is inconsistent seesaw touch "pin" numbering across different platforms. |
what hardware are you using, and what example are you using? |
I'm tinkering with perhaps strange combinations. I'm using the following: There's not too much memory in the trinket and it doesn't like the adafruit_crickit class:
So, I found the Adafruit_CircuitPython_seesaw github repository and the seesaw_crickit_test example. The library loads on the trinket and I can communicate with the crickit just fine over I2C. I took some of the example code to read the touch pins just as a test. It didn't work, it generated the Invalid touch pin error. I modified it to use touch pins 4 to 7 and can now read those pins and light corresponding leds connected to the signal pins on the crickit to 'see' a touch. However I've now tried using some motors in a similar way to the example, but it's not working because analog_writes are apparently only 1 byte so values over 255 don't work, at least that's what the code is returning as an error. I now suspect that the seesaw_crickit_test.py is not what it seems and I've perhaps misunderstood what it is for? |
Just to prove (to myself) that I'm not going completely crazy and I kind of know what I'm doing, I've swapped out the Trinket M0 with an ItsyBitsy M4 Express where the adafruit_crickit library loads. And.... everything on the crickit board now works completely as expected! I'm really not sure what the adafruit_circuitpython_seesaw library is all about as the basic I2C comms and simple I/O signals work fine. But all the PWM stuff seems to be 'broken'. I can obviously live with using the ItsyBitsy, but I thought I could put a currently unused Trinket M0 onto a crickit board and get a fully-functional robot up and running in no time. |
well the trinket m0 will def not have enough RAM for the crikit library. the itsy m4 is best to use! |
I will close this issue, even though the original touch pin problem is not entirely solved. |
Just to make sure I wasn't dreaming, I went back to the trinket M0 connected to the featherwing crickit. I erased the trinket and re-installed circuitpython 5.3.1 and the correct adafruit_seesaw, adafruit_motor and adafruit_bus_device libraries. I've ignored the top-level crickit convenience class as it is too large for the trinket memory. If I do everything long-hand to create the correct PWMOut objects for drives, servos and motors it all works fine. Of course the seesaw touch pins are 4 to 7, as you would expect with the seesaw crickit pinmap! |
Replace line 72 of seesaw_crickit_test.py: With: And it will all 'magically' start working, even when using a trinket m0 with a featherwing crickit. |
seesaw_crickit_test.py fails with a ValueError Invalid touch pin
This is not surprising as the code tries to use ss.touch_read with crickit "pins" range(4) - 0 to 3 (no pin mapping).
In the Crickit.Pinmap the touch "pins" are correctly defined as 4 to 7, so the touch_read fails with a ValueError.
How did this example ever work?
The text was updated successfully, but these errors were encountered: