Skip to content

Commit 274ce80

Browse files
authored
Using MySensors example library for Si7021 sensor (#417)
1 parent f520408 commit 274ce80

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ jobs:
387387
- eval $COMPILE
388388
- name: "SensorSI7021"
389389
script:
390-
- wget https://github.com/sparkfun/SparkFun_Si701_Breakout_Arduino_Library/archive/master.zip && unzip master.zip
391-
- sudo cp -r SparkFun_Si701_Breakout_Arduino_Library-master/src /usr/local/share/arduino/libraries
390+
- wget https://github.com/mysensors/MySensorsArduinoExamples/archive/master.zip && unzip master.zip
391+
- sudo cp -r MySensorsArduinoExamples-master/libraries/SI7021 /usr/local/share/arduino/libraries
392392
- sed -r -i 's/\/\/(SensorSI7021 .+)/\1/' $SKETCH
393393
- sed -r -i 's/\/\/(#include <sensors\/SensorSI7021.h>)/\1/' $SKETCH
394394
- eval $OTA_CONFIGURATION

sensors/SensorSI7021.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ SensorSI7021: temperature and humidity sensor
2424
*/
2525

2626
#include <Wire.h>
27-
#include "SparkFun_Si7021_Breakout_Library.h"
27+
#include <SI7021.h>
2828

2929
class SensorSI7021: public Sensor {
3030
protected:
31-
Weather* _si7021;
31+
SI7021* _si7021;
3232

3333
public:
3434
SensorSI7021(uint8_t child_id = 0): Sensor(-1) {
@@ -40,7 +40,7 @@ class SensorSI7021: public Sensor {
4040

4141
// define what to do during setup
4242
void onSetup() {
43-
_si7021 = new Weather();
43+
_si7021 = new SI7021();
4444
_si7021->begin();
4545
};
4646

@@ -49,7 +49,7 @@ class SensorSI7021: public Sensor {
4949
// temperature sensor
5050
if (child->getType() == V_TEMP) {
5151
// read the temperature
52-
float temperature = _si7021->getTemp();
52+
float temperature = (float)_si7021->getCelsiusHundredths()/100;
5353
// convert it
5454
temperature = nodeManager.celsiusToFahrenheit(temperature);
5555
// store the value
@@ -58,7 +58,7 @@ class SensorSI7021: public Sensor {
5858
// Humidity Sensor
5959
else if (child->getType() == V_HUM) {
6060
// read humidity
61-
float humidity = _si7021->getRH();
61+
float humidity = _si7021->getHumidityPercent();
6262
// store the value
6363
child->setValue(humidity);
6464
}

0 commit comments

Comments
 (0)