MPRLS Pressure Sensor Problems
- /RaspberryPi
- Corporate
- Posts: 2449
- Joined: Wed Jun 05, 2019 1:29 am
MPRLS Pressure Sensor Problems
I just bought an MPRLS ported pressure sensor and am running it off a Raspberry Pi 4b. I have the ground, Vin, SCL, and SDA properly connected from the sensor onto the Pi using 4.7 ohm resistors. The problem is when I run my code the value being recorded does not change.
Is there something wrong with my code or my wiring or something else?
My code:
import smbus
import time
bus = smbus.SMBus(1)
SENSOR_ADDRESS = 0x18
CMD_PRESSURE = 0xF0
def read_pressure():
bus.write_byte(SENSOR_ADDRESS, CMD_PRESSURE)
time.sleep(0.01)
data = bus.read_i2c_block_data(SENSOR_ADDRESS, 0x00, 3)
pressure_raw = ((data[0] & 0x3F) submitted by /u/chuckbulon
Source: https://www.reddit.com/r/raspberry_pi/c ... _problems/
/RaspberryPi