2
2
import adafruit_touchscreen
3
3
4
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.
5
+ # Change rotation variable to display setup code for the opropriate touchscreen orientation.
6
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
- '''
7
+ rotation = 270
14
8
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
- '''
9
+ if rotation == 0 :
10
+ # -------Rotate 0:
11
+ ts = adafruit_touchscreen .Touchscreen (board .TOUCH_XL , board .TOUCH_XR ,
12
+ board .TOUCH_YD , board .TOUCH_YU ,
13
+ calibration = ((5200 , 59000 ), (5800 , 57000 )),
14
+ size = (320 , 240 ))
22
15
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
- '''
16
+ if rotation == 90 :
17
+ # -------Rotate 90:
18
+ ts = adafruit_touchscreen .Touchscreen (board .TOUCH_YU , board .TOUCH_YD ,
19
+ board .TOUCH_XL , board .TOUCH_XR ,
20
+ calibration = ((5200 , 59000 ), (5800 , 57000 )),
21
+ size = (240 , 320 ))
30
22
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 ))
23
+ if rotation == 180 :
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
+ if rotation == 270 :
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
36
37
37
while True :
38
38
p = ts .touch_point
39
39
if p :
40
- print (p )
40
+ print (p )
0 commit comments