Skip to content

Commit 2bb2a13

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

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

examples/thermo3_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 the temperature using a Thermo3 Click
3+
on Mikrobus 1.
4+
"""
5+
6+
from letmecreate.core import i2c
7+
from letmecreate.core.common import MIKROBUS_1
8+
from letmecreate.click import thermo3
9+
10+
11+
# Initialise I2C on Mikrobus 1
12+
i2c.init()
13+
i2c.select_bus(MIKROBUS_1)
14+
15+
# Read temperature
16+
thermo3.enable(0)
17+
print('{} degrees celsius'.format(thermo3.get_temperature()))
18+
thermo3.disable()
19+
20+
# Release I2C
21+
i2c.release()

0 commit comments

Comments
 (0)