Skip to content

Library for reading from resistive touchscreens #2

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

Merged
merged 8 commits into from
Feb 12, 2019

Conversation

ladyada
Copy link
Member

@ladyada ladyada commented Feb 9, 2019

using just digital/analog i/o for lowest cost connection

@ladyada ladyada requested a review from a team February 9, 2019 04:20
@ladyada
Copy link
Member Author

ladyada commented Feb 11, 2019

@jerryneedell @ATMakersOrg @TG-Techie hiya wanna try this library?

@jerryneedell
Copy link

sure -- looks like fun

@jerryneedell
Copy link

jerryneedell commented Feb 11, 2019

hooked up a PID333 https://www.adafruit.com/product/333 -- it's alive !

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-beta.2-23-g72f0783b6 on 2019-02-07; Adafruit Feather M4 Express with samd51j19
>>>
>>> import touchscreen_simpletest
(23, 21, 19871)
(22, 21, 29087)
(23, 21, 31935)
(23, 21, 33471)
(23, 21, 33695)
(23, 21, 34207)
(23, 21, 33823)
(23, 21, 33631)
(23, 21, 33983)
(23, 21, 33695)
(23, 21, 33407)
(23, 21, 32831)
(23, 21, 32479)
(23, 21, 32223)
(23, 21, 31231)
(23, 21, 30047)
(23, 21, 28095)
(23, 21, 23871)

now to figure out whats x and whats y....

@TG-Techie
Copy link

Sure. I'll test it when having access to a resistive touch screen / pyportal

@jerryneedell
Copy link

It says x2/y2 must be analog capable, but I get this error:

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-beta.2-23-g72f0783b6 on 2019-02-07; Adafruit Feather M4 Express with samd51j19
>>> 
>>> 
>>> import touchscreen_simpletest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "touchscreen_simpletest.py", line 14, in <module>
  File "adafruit_touchscreen.py", line 138, in touch_point
  File "adafruit_touchscreen.py", line 138, in touch_point
  File "adafruit_touchscreen.py", line 135, in touch_point
ValueError: Pin does not have ADC capabilities
>>> 

with this test:

import board
import adafruit_touchscreen



# These pins are used as both analog and digital! XR and YU must be analog
# and digital capable. XL and YD just need to be digital
ts = adafruit_touchscreen.Touchscreen(board.D5, board.A4,
                                      board.D6, board.A1,
                                      calibration=((5200, 59000), (5800, 57000)),
                                      size=(320, 240))

while True:
    p = ts.touch_point
    if p:
        print(p)

It works if I use A1-A4

@TG-Techie
Copy link

it think it will work well with:
https://github.com/TG-Techie/tg_gui/blob/master/_touch.py
I'm excited to try

@ladyada
Copy link
Member Author

ladyada commented Feb 11, 2019

updated comments to clarify x- must also be analog (we use it for the pressure sensing

@jerryneedell
Copy link

jerryneedell commented Feb 11, 2019

I'm having some difficulty convincing myself the pins are handled correctly, but I'm not sure I have very clear documentation for the pins on my screen. https://www.adafruit.com/product/333
I can make my screen work by trial and error.

Are you convinced the pin mapping is correct? should I put more time into trying to reconcile it or just make it work?

Once I get them connected in a way that makes sense, the library seems to be working fine.

@ladyada
Copy link
Member Author

ladyada commented Feb 11, 2019

it doesnt actually matter which pins you use as long as they're connected in pairs. if you flip them around its the same as rotating the screen.

@ladyada
Copy link
Member Author

ladyada commented Feb 12, 2019

@jerryneedell zis good to merge? if so plz do a review :)

Copy link

@jerryneedell jerryneedell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I tested it with a touchscreen and once I got the pins in the right order, it seems to work well. Lots more to explore as far as function, like using the calibrations etc, but I think this is ok to merge and get out for wider test.

@ladyada ladyada merged commit d9d23ef into adafruit:master Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants