Giter Club home page Giter Club logo

adafruit_mprls's Introduction

Adafruit MPRLS Library Build StatusDocumentation

This is a library for the Adafruit MPRLS pressure sensor breakout:

Check out the links above for our tutorials and wiring diagrams. This chip uses I2C to communicate

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution

adafruit_mprls's People

Contributors

arkhipenko avatar caternuson avatar devinmui avatar evaherrada avatar hoffmannjan avatar ladyada avatar lawrencegeafer avatar siddacious avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_mprls's Issues

Potential for getting stuck in while loops

There are two while loops in readData() which can turn into forever-loops if hardware is disconnected or things otherwise don't go as expected. Can I suggest adding a count variable, and something like this code inside each loop:

count++; delay(1); if(count>100) //Frozen or something return 0xFFFFFFFF; //Error

Speed up the sensor readings

  • Arduino board: Arduino Uno
  • Arduino IDE version 1.8.13

Hi,

I found, that my code runs quite slow, when using the MPRLS library and reading from the sensor. I reported this issue in the Adafruit customers forum, see:
https://forums.adafruit.com/viewtopic.php?f=19&t=167853

In short, I was not able to read data from the sensor more than around 66 times per second (66Hz), although the sensors datasheet claims up to 200Hz.

The problem comes from the file "Adafruit_MPRLS.cpp", where the function "readData(void)" contains these lines:

// Use the gpio to tell end of conversion
if (_eoc != -1) {
while (!digitalRead(_eoc)) {
delay(10);
}
} else {
// check the status byte
uint8_t stat;
while ((stat = readStatus()) & MPRLS_STATUS_BUSY) {
// Serial.print("Status: "); Serial.println(stat, HEX);
delay(10);
}
}

Deleting the delays nearly doubled the speed of my readings to 125Hz. This is not as fast as advertised (I think you have to make use of the EOC-pin to become faster) but still a significant performance gain.

I suggest deleting the delays.

Thanks,

Larry

The begin() function is misleading.

In the .h file (Adafruit_MPRLS.h) at line 44 & 45, the begin() function has two arguments: uint8_t i2c_addr and TwoWire *twoWire.

I also see they were assigned:
i2c_addr is assigned to MPRLS_DEFAULT_ADDR
and
twoWire is de-referenced to Wire. Where is this 'Wire' defined or instantiated?
My common sense says it's from 'Wire.h'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.