Git Product home page Git Product logo

arduino_flex's Introduction

Arduino Flex Libraries

Arduino is great for multiple reasons but one includes the availability of libraries from companies like Adafruit and Sparkfun for popular sensors. They do a great job by taking away a lot of tedious work for developers.

They however do not seem to program their libraries in such a way that they are flexible to use. This is problematic since it severely limits it's usability especially. Problems include:

  • i2c-bus issues (because libraries might issue multiple Wire.begin commands)
  • not being able to combine sensors
  • not being able to use the sensor on a different bus

We try to convert their libraries to a more flexible version that uses dependency injection of TwoWire (for now we only converted i2c libraries).

See the output of using two HTU21DF sensors (at two different i2c busses using SAMD21): alt text

Notes

Those libraries often do a begin on Wire inside the library. These lines were commented out. For convenience a init was implemented. Some libraries do need sensor initialization. We also linked "begin" to this init method which calls init. Always first issue a Wire (or custom e.g. myWire) begin, only then call the library method to avoid bus issues.

Warning: some libraries (including HTU21DF) do not seem to like operating when Wire is used as a slave (e.g. Wire.begin(mySlaveAddress)): in that case the bus hangs.

Supported Libraries:

  • HTU21DF - Based on Adafruit Library
  • FXAS21002C - Based on Adafruit Library
  • FXOS8700 - Based on Adafruit Library
  • MPL3115A2 - Based on Sparkfun Library
  • BQ27441 - Based in Sparkfun Library

Other Information:

Enjoy. Comments / questions: feel free to reach out.

arduino_flex's People

Contributors

jakorten avatar

Watchers

 avatar

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.