Skip to content

Commit 46636f1

Browse files
committed
examples update
1 parent b04fac4 commit 46636f1

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

docs/examples.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ Simple test
33

44
Ensure your device works with this simple test.
55

6-
.. literalinclude:: ../examples/apds9960_color_simpletest.py
7-
:caption: examples/apds9960_color_simpletest.py
6+
.. literalinclude:: ../examples/apds9960_simpletest.py
7+
:caption: examples/apds9960_simpletest.py
88
:linenos:
99

1010

11-
Gesture Example
12-
---------------
11+
Proximity Example
12+
-----------------
1313

14-
Show how to use the device with simple gestures
14+
Example illustrating proximity detection
1515

16-
.. literalinclude:: ../examples/apds9960_gesture_simpletest.py
17-
:caption: examples/apds9960_gesture_simpletest.py
16+
.. literalinclude:: ../examples/apds9960_proximity_simpletest.py
17+
:caption: examples/apds9960_proximity_simpletest.py
1818
:linenos:
1919

2020

21-
Proximity Example
22-
-----------------
21+
Gesture Example
22+
---------------
2323

24-
Example showing proximity feature
24+
Example illustrating gesture detection
2525

26-
.. literalinclude:: ../examples/apds9960_proximity_simpletest.py
27-
:caption: examples/apds9960_proximity_simpletest.py
26+
.. literalinclude:: ../examples/apds9960_gesture_simpletest.py
27+
:caption: examples/apds9960_gesture_simpletest.py
2828
:linenos:
2929

3030

3131
Color Example
3232
---------------
3333

34-
Example showing how to get RGB values
34+
Example illustrating color detection
3535

3636
.. literalinclude:: ../examples/apds9960_color_simpletest.py
3737
:caption: examples/apds9960_color_simpletest.py

examples/apds9960_color_simpletest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313

1414
while True:
15-
# create some variables to store the color data in
16-
1715
# wait for color data to be ready
1816
while not apds.color_data_ready:
1917
time.sleep(0.005)

examples/apds9960_proximity_simpletest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77

88
i2c = board.I2C()
99
int_pin = digitalio.DigitalInOut(board.D5)
10+
int_pin.switch_to_input(pull=digitalio.Pull.UP)
1011
apds = APDS9960(i2c)
1112

12-
apds.enable_proximity = True
13+
# set the interrupt threshold to fire when proximity reading goes above 175
1314
apds.proximity_interrupt_threshold = (0, 175)
15+
16+
# assert the interrupt pin when the proximity interrupt is triggered
1417
apds.enable_proximity_interrupt = True
1518

19+
# enable the sensor's proximity engine
20+
apds.enable_proximity = True
21+
1622
while True:
1723
# print the proximity reading when the interrupt pin goes low
1824
if not int_pin.value:

0 commit comments

Comments
 (0)