MCP9808 (community library)
Summary
Name | Value |
---|---|
Name | MCP9808 |
Version | 0.1.2 |
Installs | |
License | GPLv3 |
Author | Romain MP romain.mp@gmail.com |
URL | https://github.com/romainmp/MCP9808 |
Repository | https://github.com/romainmp/MCP9808.git |
Download | .tar.gz |
All Versions | 0.1.2, 0.1.1, 0.0.13, 0.0.12, 0.0.11 |
Library to support MCP9808 high precision temperature sensor
Example Build Testing
Device OS Version:
This table is generated from an automated build. Success only indicates that the code compiled successfully.
Library Read Me
This content is provided by the library maintainer and has not been validated or approved.
MCP9808
A Library to add support of MCP9808 precision temperature sensor to Particle core (Formerly Spark Core).
Usage
Before your setup function
#include "MCP9808.h"
MCP9808 mcp = MCP9808();
In your setup function
// MCP9808 sensor setup
while(! mcp.begin()){
Serial.println("Couldnt find MCP9808");
delay(1000);
}
mcp.setResolution(MCP9808_SLOWEST);
In your loop you can now get the temperature like that
temperature = mcp.getTemperature();
Options
Power modes
The MCP9808 offers a continuous conversion mode or a low-power mode where the sensor only draw 0.1µA. The low power mode is also called shutdown mode. Continuous conversion is the default mode. You can select either with setPowerMode :
mcp.setPowerMode(MCP9808_CONTINUOUS);
or
mcp.setPowerMode(MCP9808_LOW_POWER);
Resolution and Speed modes
If you want to get more frequent temperature readings you'll need to lower the resolution. The best resolution is +/-0.0625°C resolution and takes 250ms of conversion time : MCP9808_SLOWEST The fastest conversion time is 30ms and has a resolution of +/- 0.5°C : MCP9808_FASTEST MCP9808_SLOWEST / MCP9808_SLOW / MCP9808_FAST / MCP9808_FASTEST
mcp.setResolution(MCP9808_SLOWEST);
Contributing
- Fork it (https://github.com/romainmp/MCP9808/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Browse Library Files