Skip to content

Commit 19a948d

Browse files
committed
i2c works
1 parent 35718a9 commit 19a948d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

source/examples/python/i2c.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
# Read a TMP101 sensor
3+
4+
import smbus
5+
import time
6+
bus = smbus.SMBus(1)
7+
address = 0x49
8+
9+
while True:
10+
temp = bus.read_byte_data(address, 0)
11+
print (temp)
12+
time.sleep(0.25)

source/examples/python/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Here's what you need to install to run these.
2+
3+
sudo apt-get install python3-smbus

0 commit comments

Comments
 (0)