Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Raspberry Pi) expand_more
Raspberry Pi / Sensors & Buses

I2C sensor read

Learn I2C sensor read in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.

12 min read • Intermediate
raspberry-pi-018.py
python
from smbus2 import SMBus
ADDR=0x48
with SMBus(1) as bus:
    raw=bus.read_word_data(ADDR,0x00)
print(hex(raw))
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content