Skip to content

Commit 54f3c05

Browse files
add proximity example
Signed-off-by: Francois Berder <[email protected]>
1 parent 2bb2a13 commit 54f3c05

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

examples/proximity_example.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
"""This example shows how to read a measure from the Proximity Click inserted
3+
in Mikrobus 1.
4+
"""
5+
6+
from letmecreate.core import i2c
7+
from letmecreate.core.common import MIKROBUS_1
8+
from letmecreate.click import proximity
9+
10+
11+
# Initialise I2C on Mikrobus 1
12+
i2c.init()
13+
i2c.select_bus(MIKROBUS_1)
14+
15+
# Read measure from Proximity Click
16+
proximity.enable()
17+
print('measure: {}'.format(proximity.get_measure()))
18+
proximity.disable()
19+
20+
# Release I2C
21+
i2c.release()

0 commit comments

Comments
 (0)