Skip to main content

A library to use XPT2046 touch module

Project description

XPT2046_asukiaaa_python

Python library for XPT2046 Touchscreen. This library references Luca8991/XPT2046-Python and Adafruit_CircuitPython_RGB_Display.

Usage

Enable SPI for Raspberry Pi

sudo raspi-config nonint do_spi 0

No need to reboot.

Wiring

Raspberri Pi <--> XPT2046
MOSI (GPIO10) <--> DIN
MISO (GPIO9) <--> DO
SCLK (GPIO11) <--> CLK
GPIO7 or any <--> CS
3V3 <--> VCC
GND <--> GND

This library does not use IRQ pin.

Code, same as in tests/print_touch.py file:

from XPT2046_asukiaaa_python import XPT2046
import board
import busio
from digitalio import DigitalInOut
from time import sleep

cs = DigitalInOut(board.D7)
spi = busio.SPI(board.SCLK, board.MOSI, board.MISO)
touch = XPT2046(spi, cs=cs)

print("start monitoring touch")

while True:
    touch.update()
    if touch.coordinate is not None:
        print(touch.coordinate)
    sleep(.01)

License

MIT

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

XPT2046-asukiaaa-python-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

XPT2046_asukiaaa_python-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file XPT2046-asukiaaa-python-1.0.0.tar.gz.

File metadata

File hashes

Hashes for XPT2046-asukiaaa-python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 49919fea701f5956dc190cba8572035d03c68d3232b0eead0ba515514319d562
MD5 2ba7f4e4ce141142a5c2b4b15a7d7db2
BLAKE2b-256 e56000b9df4d9597d3b275ce00e145b13c4b25f8ed6850bf353d54e9a55a59c9

See more details on using hashes here.

File details

Details for the file XPT2046_asukiaaa_python-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for XPT2046_asukiaaa_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27f58842b0cb017e2c60470b6ba9d05a2ee8823f19a7b38f37846529aadecf82
MD5 e6c9afeb407f5a9142329f8381b3ab9c
BLAKE2b-256 e1da8591d1515233cf208e1185a1efa64f56a0723708942a26c698836c80a156

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page