mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.4.0 MS5611
This commit is contained in:
parent
08d123b360
commit
596e6d78f8
@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.4.0] - 2023-11-14
|
||||
- simplify begin()
|
||||
- refactor constructor
|
||||
- update readme.md
|
||||
- update examples
|
||||
- add ESP32 and RP2040 minimal example.
|
||||
- update keywords.txt
|
||||
|
||||
----
|
||||
|
||||
## [0.3.9] - 2022-10-26
|
||||
- add RP2040 support to build-CI
|
||||
- add CHANGELOG.md
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2023 Rob Tillaart
|
||||
Copyright (c) 2014-2024 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -2,8 +2,8 @@
|
||||
// FILE: MS5611.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// Erni - testing/fixes
|
||||
// VERSION: 0.3.9
|
||||
// PURPOSE: MS5611 Temperature & Humidity library for Arduino
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: Arduino library for MS5611 temperature and pressure sensor
|
||||
// URL: https://github.com/RobTillaart/MS5611
|
||||
//
|
||||
// HISTORY see changelog.md
|
||||
@ -24,9 +24,10 @@
|
||||
//
|
||||
// PUBLIC
|
||||
//
|
||||
MS5611::MS5611(uint8_t deviceAddress)
|
||||
MS5611::MS5611(uint8_t deviceAddress, TwoWire * wire)
|
||||
{
|
||||
_address = deviceAddress;
|
||||
_wire = wire;
|
||||
_samplingRate = OSR_ULTRA_LOW;
|
||||
_temperature = MS5611_NOT_READ;
|
||||
_pressure = MS5611_NOT_READ;
|
||||
@ -39,30 +40,9 @@ MS5611::MS5611(uint8_t deviceAddress)
|
||||
}
|
||||
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool MS5611::begin(uint8_t dataPin, uint8_t clockPin, TwoWire * wire)
|
||||
bool MS5611::begin()
|
||||
{
|
||||
if ((_address < 0x76) || (_address > 0x77)) return false;
|
||||
|
||||
_wire = wire;
|
||||
if ((dataPin < 255) && (clockPin < 255))
|
||||
{
|
||||
_wire->begin(dataPin, clockPin);
|
||||
} else {
|
||||
_wire->begin();
|
||||
}
|
||||
if (! isConnected()) return false;
|
||||
|
||||
return reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool MS5611::begin(TwoWire * wire)
|
||||
{
|
||||
if ((_address < 0x76) || (_address > 0x77)) return false;
|
||||
_wire = wire;
|
||||
_wire->begin();
|
||||
if (! isConnected()) return false;
|
||||
|
||||
return reset();
|
||||
|
@ -3,7 +3,7 @@
|
||||
// FILE: MS5611.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// Erni - testing/fixes
|
||||
// VERSION: 0.3.9
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: Arduino library for MS5611 temperature and pressure sensor
|
||||
// URL: https://github.com/RobTillaart/MS5611
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
#define MS5611_LIB_VERSION (F("0.3.9"))
|
||||
#define MS5611_LIB_VERSION (F("0.4.0"))
|
||||
|
||||
#ifndef MS5611_DEFAULT_ADDRESS
|
||||
#define MS5611_DEFAULT_ADDRESS 0x77
|
||||
@ -54,12 +54,9 @@ enum osr_t
|
||||
class MS5611
|
||||
{
|
||||
public:
|
||||
explicit MS5611(uint8_t deviceAddress = MS5611_DEFAULT_ADDRESS);
|
||||
explicit MS5611(uint8_t deviceAddress = MS5611_DEFAULT_ADDRESS, TwoWire *wire = &Wire);
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool begin(uint8_t sda, uint8_t scl, TwoWire *wire = &Wire);
|
||||
#endif
|
||||
bool begin(TwoWire *wire = &Wire);
|
||||
bool begin();
|
||||
bool isConnected();
|
||||
|
||||
// reset command + get constants
|
||||
@ -97,7 +94,7 @@ public:
|
||||
// last time in millis() when the sensor has been read.
|
||||
uint32_t lastRead() const { return _lastRead; };
|
||||
|
||||
// _deviceID is a SHIFT XOR merge of 7 PROM registers, reasonable unique
|
||||
// _deviceID is a SHIFT XOR merge of 7 PROM registers, reasonable unique
|
||||
uint32_t getDeviceID() const { return _deviceID; };
|
||||
|
||||
void setCompensation(bool flag = true) { _compensation = flag; };
|
||||
@ -138,5 +135,5 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,13 +2,16 @@
|
||||
[![Arduino CI](https://github.com/RobTillaart/MS5611/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/MS5611/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/MS5611/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/MS5611/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/MS5611/actions/workflows/jsoncheck.yml)
|
||||
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/MS5611.svg)](https://github.com/RobTillaart/MS5611/issues)
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MS5611/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/MS5611.svg?maxAge=3600)](https://github.com/RobTillaart/MS5611/releases)
|
||||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/MS5611.svg)](https://registry.platformio.org/libraries/robtillaart/MS5611)
|
||||
|
||||
|
||||
# MS5611
|
||||
|
||||
Arduino library for MS5611 pressure (and temperature) sensor.
|
||||
Arduino library for MS5611 temperature and pressure sensor.
|
||||
|
||||
|
||||
## Description
|
||||
@ -118,19 +121,29 @@ The library implements **reset(uint8_t mathMode = 0)** to select the mathMode.
|
||||
|
||||
See issue #33.
|
||||
|
||||
#### 0.4.0 breaking change
|
||||
|
||||
refactored the Wire dependency. Affected are:
|
||||
- constructor
|
||||
- begin()
|
||||
|
||||
User has to call **Wire.begin()** (or equivalent) before calling **ms5611.begin()**
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
```cpp
|
||||
#include "MS5611.h"
|
||||
```
|
||||
|
||||
#### Base
|
||||
|
||||
- **MS5611(uint8_t deviceAddress = MS5611_DEFAULT_ADDRESS)** constructor.
|
||||
Since 0.3.7 a default address 0x77 is added.
|
||||
- **bool begin(uint8_t sda, uint8_t scl, TwoWire \*wire = &Wire)** for ESP and alike, optionally set Wire interface.
|
||||
- **MS5611(uint8_t deviceAddress = MS5611_DEFAULT_ADDRESS, TwoWire \*wire = &Wire)** constructor.
|
||||
Since 0.3.7 a default address 0x77 is added. Optionally set Wire interface.
|
||||
- **bool begin()**
|
||||
Initializes internals by calling reset().
|
||||
Return false indicates either isConnected() error or reset() error.
|
||||
- **bool begin(TwoWire \*wire = &Wire)** for UNO and alike, optionally set Wire interface.
|
||||
Initializes internals by calling reset().
|
||||
Return false indicates either isConnected() error or reset() error.
|
||||
Return false indicates either isConnected() error or reset() error.
|
||||
One must call **Wire.begin()** (or equivalent) before calling **begin()**.
|
||||
- **bool isConnected()** checks availability of device address on the I2C bus.
|
||||
(see note above NANO 33 BLE).
|
||||
- **bool reset(uint8_t mathMode = 0)** resets the chip and loads constants from its ROM.
|
||||
@ -218,22 +231,30 @@ Disabling the compensation will be slightly faster but you loose precision.
|
||||
- **getCompensation()** returns flag set above.
|
||||
|
||||
|
||||
## Operation
|
||||
|
||||
See examples
|
||||
|
||||
|
||||
## Future
|
||||
|
||||
#### must
|
||||
#### Must
|
||||
|
||||
- update documentation
|
||||
|
||||
#### should
|
||||
#### Should
|
||||
|
||||
- proper error handling.
|
||||
- move all code to .cpp
|
||||
|
||||
#### could
|
||||
#### Could
|
||||
|
||||
- redo lower level functions?
|
||||
- handle the read + math of temperature first?
|
||||
|
||||
#### Wont
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
If you appreciate my libraries, you can support the development and maintenance.
|
||||
Improve the quality of the libraries by providing issues and Pull Requests, or
|
||||
donate through PayPal or GitHub sponsors.
|
||||
|
||||
Thank you,
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
#ifndef LED_BUILTIN
|
||||
@ -39,14 +40,15 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -136,4 +138,4 @@ void test()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -6,8 +6,8 @@
|
||||
// URL: https://github.com/RobTillaart/MS5611
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Wire.h"
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
@ -31,12 +31,18 @@
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
Wire.beginTransmission(0x76);
|
||||
Wire.write(0);
|
||||
int x = Wire.endTransmission();
|
||||
|
||||
Wire.beginTransmission(0x77);
|
||||
Wire.write(0);
|
||||
int y = Wire.endTransmission();
|
||||
@ -45,9 +51,9 @@ void setup()
|
||||
Serial.println(y);
|
||||
delay(1000);
|
||||
|
||||
if (x == 0) Serial.println("MS5611 found at 0x76");
|
||||
if (x == 0) Serial.println("MS5611 found at 0x76");
|
||||
else if (y == 0) Serial.println("MS5611 found at 0x77");
|
||||
else Serial.println("no MS5611 found");
|
||||
else Serial.println("no MS5611 found");
|
||||
|
||||
Serial.println("done...");
|
||||
}
|
||||
@ -58,4 +64,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -26,6 +26,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
@ -36,14 +37,15 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.print("MS5611 found: ");
|
||||
@ -69,4 +71,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,19 +27,21 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while(!Serial);
|
||||
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -54,7 +57,7 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
MS5611.read(); // note no error checking => "optimistic".
|
||||
MS5611.read(); // note no error checking => "optimistic".
|
||||
Serial.print("T:\t");
|
||||
Serial.print(MS5611.getTemperature(), 2);
|
||||
Serial.print("\tP:\t");
|
||||
@ -64,4 +67,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -0,0 +1,29 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
# - uno
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
# - m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
# - rpipico
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
//
|
||||
// FILE: MS5611_minimal_ESP32.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo application
|
||||
// DATE: 2023-11-14
|
||||
// URL: https://github.com/RobTillaart/MS5611
|
||||
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
// +--------+
|
||||
// VCC VCC | o |
|
||||
// GND GND | o |
|
||||
// SCL | o |
|
||||
// SDI SDA | o |
|
||||
// CSO | o |
|
||||
// SDO | o L | L = led
|
||||
// PS | o O | O = opening PS = protocol select
|
||||
// +--------+
|
||||
//
|
||||
// PS to VCC ==> I2C (GY-63 board has internal pull up, so not needed)
|
||||
// PS to GND ==> SPI
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin(22, 23); // adjust ESP32 pins if needed
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("MS5611 not found. halt.");
|
||||
while (1);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
MS5611.read(); // note no error checking => "optimistic".
|
||||
Serial.print("T:\t");
|
||||
Serial.print(MS5611.getTemperature(), 2);
|
||||
Serial.print("\tP:\t");
|
||||
Serial.print(MS5611.getPressure(), 2);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
@ -0,0 +1,29 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
# - uno
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
# - m4
|
||||
# - esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
||||
|
@ -0,0 +1,72 @@
|
||||
//
|
||||
// FILE: MS5611_minimal_RP2040.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo application
|
||||
// DATE: 2023-11-14
|
||||
// URL: https://github.com/RobTillaart/MS5611
|
||||
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
// +--------+
|
||||
// VCC VCC | o |
|
||||
// GND GND | o |
|
||||
// SCL | o |
|
||||
// SDI SDA | o |
|
||||
// CSO | o |
|
||||
// SDO | o L | L = led
|
||||
// PS | o O | O = opening PS = protocol select
|
||||
// +--------+
|
||||
//
|
||||
// PS to VCC ==> I2C (GY-63 board has internal pull up, so not needed)
|
||||
// PS to GND ==> SPI
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
Wire.setSDA(14); // adjust RP2040 pins if needed
|
||||
Wire.setSCL(15); // adjust RP2040 pins if needed
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("MS5611 not found. halt.");
|
||||
while (1);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
MS5611.read(); // note no error checking => "optimistic".
|
||||
Serial.print("T:\t");
|
||||
Serial.print(MS5611.getTemperature(), 2);
|
||||
Serial.print("\tP:\t");
|
||||
Serial.print(MS5611.getPressure(), 2);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,6 +27,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
@ -35,15 +37,15 @@ uint32_t start, stop, count;
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while(!Serial);
|
||||
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
|
||||
|
||||
Wire.begin();
|
||||
// Wire.setClock(100000);
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -55,7 +57,6 @@ void setup()
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
// Wire.setClock(100000);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@ -65,7 +66,7 @@ void loop()
|
||||
delay(1000);
|
||||
|
||||
start = micros();
|
||||
int result = MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
|
||||
int result = MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
|
||||
stop = micros();
|
||||
|
||||
if (count % 20 == 0)
|
||||
@ -88,4 +89,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,6 +27,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
@ -35,13 +37,14 @@ uint32_t start, stop;
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while(!Serial);
|
||||
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -108,10 +111,11 @@ void setup()
|
||||
Serial.println("\ndone...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,6 +27,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
#ifndef LED_BUILTIN
|
||||
@ -39,14 +41,15 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -133,5 +136,5 @@ void test()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,6 +27,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
@ -36,14 +38,15 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -75,6 +78,7 @@ void setup()
|
||||
OSR_LOW -> 1.1 millis
|
||||
OSR_ULTRA_LOW -> 0.5 millis Default = backwards compatible
|
||||
*/
|
||||
|
||||
void loop()
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
@ -133,4 +137,4 @@ void test()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -26,6 +27,7 @@
|
||||
// CS to VCC ==> 0x76
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 MS5611(0x77);
|
||||
|
||||
|
||||
@ -33,10 +35,17 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Wire.begin();
|
||||
if (MS5611.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 found.");
|
||||
@ -53,7 +62,8 @@ void setup()
|
||||
}
|
||||
}
|
||||
Serial.println("TEMP\tPRESSURE");
|
||||
// scale T & P to same range :)
|
||||
|
||||
// scale T & P to same range :)
|
||||
MS5611.setPressureOffset(-1000);
|
||||
}
|
||||
|
||||
@ -70,4 +80,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "MS5611.h"
|
||||
|
||||
|
||||
// BREAKOUT MS5611 aka GY63 - see datasheet
|
||||
//
|
||||
// SPI I2C
|
||||
@ -27,8 +28,8 @@
|
||||
// CS to GND ==> 0x77
|
||||
|
||||
|
||||
MS5611 ONE(0x76); // 0x76 = CSB to VCC
|
||||
MS5611 TWO(0x77); // 0x77 = CSB to GND
|
||||
MS5611 ONE(0x76); // 0x76 = CSB to VCC
|
||||
MS5611 TWO(0x77); // 0x77 = CSB to GND
|
||||
|
||||
|
||||
uint32_t start, stop;
|
||||
@ -38,14 +39,15 @@ void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Serial.println();
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("MS5611_LIB_VERSION: ");
|
||||
Serial.println(MS5611_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
Wire.begin();
|
||||
if (ONE.begin() == true)
|
||||
{
|
||||
Serial.println("MS5611 0x76 found.");
|
||||
@ -105,4 +107,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -24,6 +24,9 @@ getTemperatureOffset KEYWORD2
|
||||
setPressureOffset KEYWORD2
|
||||
getPressureOffset KEYWORD2
|
||||
|
||||
getLastResult KEYWORD2
|
||||
lastRead KEYWORD2
|
||||
|
||||
getDeviceID KEYWORD2
|
||||
|
||||
setCompensation KEYWORD2
|
||||
@ -43,3 +46,9 @@ MS5611_READ_OK LITERAL1
|
||||
MS5611_ERROR_2 LITERAL1
|
||||
MS5611_NOT_READ LITERAL1
|
||||
|
||||
OSR_ULTRA_HIGH LITERAL1
|
||||
OSR_HIGH LITERAL1
|
||||
OSR_STANDARD LITERAL1
|
||||
OSR_LOW LITERAL1
|
||||
OSR_ULTRA_LOW LITERAL1
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/MS5611.git"
|
||||
},
|
||||
"version": "0.3.9",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
"headers": "MS5611.h"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=MS5611
|
||||
version=0.3.9
|
||||
version=0.4.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for MS5611 temperature and pressure sensor
|
||||
|
@ -72,6 +72,8 @@ unittest(test_constants)
|
||||
unittest(test_constructor)
|
||||
{
|
||||
MS5611 sensor(0x77);
|
||||
|
||||
Wire.begin();
|
||||
assertFalse(sensor.begin()); // as there is no sensor, and no ROM values.
|
||||
|
||||
assertEqualFloat(-9.99, sensor.getTemperature(), 0.01);
|
||||
@ -85,6 +87,7 @@ unittest(test_read_sensor)
|
||||
{
|
||||
MS5611 sensor(0x77);
|
||||
|
||||
Wire.begin();
|
||||
assertFalse(sensor.begin());
|
||||
|
||||
assureEqual(MS5611_READ_OK, sensor.read());
|
||||
@ -101,6 +104,7 @@ unittest(test_overSampling)
|
||||
{
|
||||
MS5611 sensor(0x77);
|
||||
|
||||
Wire.begin();
|
||||
assertFalse(sensor.begin());
|
||||
|
||||
// default
|
||||
@ -118,6 +122,9 @@ unittest(test_overSampling)
|
||||
assureEqual(OSR_ULTRA_HIGH, sensor.getOversampling());
|
||||
}
|
||||
|
||||
|
||||
unittest_main()
|
||||
|
||||
// --------
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user