File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -3,35 +3,35 @@ Simple test
3
3
4
4
Ensure your device works with this simple test.
5
5
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
8
8
:linenos:
9
9
10
10
11
- Gesture Example
12
- ---------------
11
+ Proximity Example
12
+ -----------------
13
13
14
- Show how to use the device with simple gestures
14
+ Example illustrating proximity detection
15
15
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
18
18
:linenos:
19
19
20
20
21
- Proximity Example
22
- -----------------
21
+ Gesture Example
22
+ ---------------
23
23
24
- Example showing proximity feature
24
+ Example illustrating gesture detection
25
25
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
28
28
:linenos:
29
29
30
30
31
31
Color Example
32
32
---------------
33
33
34
- Example showing how to get RGB values
34
+ Example illustrating color detection
35
35
36
36
.. literalinclude :: ../examples/apds9960_color_simpletest.py
37
37
:caption: examples/apds9960_color_simpletest.py
Original file line number Diff line number Diff line change 12
12
13
13
14
14
while True :
15
- # create some variables to store the color data in
16
-
17
15
# wait for color data to be ready
18
16
while not apds .color_data_ready :
19
17
time .sleep (0.005 )
Original file line number Diff line number Diff line change 7
7
8
8
i2c = board .I2C ()
9
9
int_pin = digitalio .DigitalInOut (board .D5 )
10
+ int_pin .switch_to_input (pull = digitalio .Pull .UP )
10
11
apds = APDS9960 (i2c )
11
12
12
- apds . enable_proximity = True
13
+ # set the interrupt threshold to fire when proximity reading goes above 175
13
14
apds .proximity_interrupt_threshold = (0 , 175 )
15
+
16
+ # assert the interrupt pin when the proximity interrupt is triggered
14
17
apds .enable_proximity_interrupt = True
15
18
19
+ # enable the sensor's proximity engine
20
+ apds .enable_proximity = True
21
+
16
22
while True :
17
23
# print the proximity reading when the interrupt pin goes low
18
24
if not int_pin .value :
You can’t perform that action at this time.
0 commit comments