AJB2K3
Published © CC BY-NC-SA

Python on the CoreMP135

How to access and Programme or the M5Stack CoreMP135.

IntermediateProtip1 hour48
Python on the CoreMP135

Things used in this project

Story

Read more

Code

ENVIII SHT30 TEST

Python
import smbus
import time

bus = smbus.SMBus(1)

bus.write_i2c_block_data(0x44, 0x2C, [0x06])
time.sleep(0.5)

data = bus.read_i2c_block_data(0x44, 0x00, 6)

cTemp = ((((data[0] * 256.0) + data[1]) * 175) / 65535.0) - 45
fTemp = cTemp * 1.8 + 32
humidity = 100 * (data[3] * 256 + data[4]) / 65535.0

print("Relative Humidity : %.2f %%RH" %humidity)
print("Temperature in Celsius : %.2f C" %cTemp)
print("Temperature in Freedom Heat : %.2f F" %fTemp)

Credits

AJB2K3

AJB2K3

54 projects • 33 followers
I have always had an interest in electronics but having failed my school exams, it has taken me 20+ years to produce products to share.

Comments