Skip to content

Commit d891ff6

Browse files
authored
Merge pull request #14 from TG-Techie/master
Correct the Readme and Print Example
2 parents 8c31952 + a1a4f15 commit d891ff6

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

README.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,23 @@ Usage Example
5959
.. code-block:: python
6060
6161
import time
62-
import busio
6362
import board
63+
import busio
6464
import adafruit_focaltouch
6565
66-
# Create library object using our Bus I2C port
66+
# Create library object (named "ft") using a Bus I2C port
6767
i2c = busio.I2C(board.SCL, board.SDA)
6868
69-
ft = adafruit_focaltouch.Adafruit_FocalTouch(i2c, debug=True)
69+
ft = adafruit_focaltouch.Adafruit_FocalTouch(i2c, debug=False)
7070
7171
while True:
72-
n = ft.touched
73-
if n:
74-
print(ft.touches)
72+
# if the screen is being touched print the touches
73+
if ft.touched:
74+
print(ft.touches)
75+
else:
76+
print('no touch')
77+
78+
time.sleep(.15)
7579
7680
Contributing
7781
============

examples/focaltouch_print_touches.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
touch driver, over I2C
44
"""
55

6+
import time
67
import busio
78
import board
89
import adafruit_focaltouch
910

10-
# Create library object using our Bus I2C port
11+
# Create library object (named "ft") using a Bus I2C port
1112
i2c = busio.I2C(board.SCL, board.SDA)
1213

13-
ft = adafruit_focaltouch.Adafruit_FocalTouch(i2c, debug=True)
14+
ft = adafruit_focaltouch.Adafruit_FocalTouch(i2c, debug=False)
1415

1516
while True:
16-
n = ft.touched
17-
if n:
17+
# if the screen is being touched print the touches
18+
if ft.touched:
1819
print(ft.touches)
20+
else:
21+
print('no touch')
22+
23+
time.sleep(.15)

0 commit comments

Comments
 (0)