1
+ import board
2
+ import adafruit_touchscreen
3
+
4
+ # Allign the touchscreen so that the top left corner reads as x=0, y=0
5
+ # Uncoment the display setup code for the opropriate touchscreen orientation.
6
+
7
+ '''
8
+ # -------Rotate 0:
9
+ ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
10
+ board.TOUCH_YD, board.TOUCH_YU,
11
+ calibration=((5200, 59000), (5800, 57000)),
12
+ size=(320, 240))
13
+ '''
14
+
15
+ '''
16
+ # -------Rotate 90:
17
+ ts = adafruit_touchscreen.Touchscreen(board.TOUCH_YU, board.TOUCH_YD,
18
+ board.TOUCH_XL, board.TOUCH_XR,
19
+ calibration=((5200, 59000), (5800, 57000)),
20
+ size=(240, 320))
21
+ '''
22
+
23
+ '''
24
+ # ------Rotate 180:
25
+ ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XR, board.TOUCH_XL,
26
+ board.TOUCH_YU, board.TOUCH_YD,
27
+ calibration=((5200, 59000), (5800, 57000)),
28
+ size=(320, 240))
29
+ '''
30
+
31
+ # ------Rotate 270:
32
+ ts = adafruit_touchscreen .Touchscreen (board .TOUCH_YD , board .TOUCH_YU ,
33
+ board .TOUCH_XR , board .TOUCH_XL ,
34
+ calibration = ((5200 , 59000 ), (5800 , 57000 )),
35
+ size = (240 , 320 ))
36
+
37
+ while True :
38
+ p = ts .touch_point
39
+ if p :
40
+ print (p )
0 commit comments