Skip to content

Commit 06eb77a

Browse files
author
joeleb
committed
Updating library files
1 parent 5479d20 commit 06eb77a

File tree

7 files changed

+468
-60
lines changed

7 files changed

+468
-60
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/******************************************************************************
2+
SparkFun Si7021 Breakout Example
3+
Joel Bartlett @ SparkFun Electronics
4+
Original Creation Date: May 18, 2015
5+
Updated May 4, 2016
6+
This sketch prints the temperature and humidity the Serial port.
7+
8+
The library used in this example can be found here:
9+
https://github.com/sparkfun/Si7021_Breakout/tree/master/Libraries
10+
11+
Hardware Connections:
12+
HTU21D ------------- Photon
13+
(-) ------------------- GND
14+
(+) ------------------- 3.3V (VCC)
15+
CL ------------------- D1/SCL
16+
DA ------------------- D0/SDA
17+
18+
Development environment specifics:
19+
IDE: Particle Dev
20+
Hardware Platform: SparkFun RedBoard
21+
Arduino IDE 1.6.5
22+
23+
This code is beerware; if you see me (or any other SparkFun
24+
employee) at the local, and you've found our code helpful,
25+
please buy us a round!
26+
Distributed as-is; no warranty is given.
27+
*******************************************************************************/
28+
#include "SparkFun_Si7021_Breakout_Library.h"
29+
#include <Wire.h>
30+
31+
float humidity = 0;
32+
float tempf = 0;
33+
34+
35+
int power = A3;
36+
int GND = A2;
37+
38+
//Create Instance of HTU21D or SI7021 temp and humidity sensor and MPL3115A2 barrometric sensor
39+
Weather sensor;
40+
41+
//---------------------------------------------------------------
42+
void setup()
43+
{
44+
Serial.begin(9600); // open serial over USB at 9600 baud
45+
46+
pinMode(power, OUTPUT);
47+
pinMode(GND, OUTPUT);
48+
49+
digitalWrite(power, HIGH);
50+
digitalWrite(GND, LOW);
51+
52+
//Initialize the I2C sensors and ping them
53+
sensor.begin();
54+
55+
}
56+
//---------------------------------------------------------------
57+
void loop()
58+
{
59+
//Get readings from all sensors
60+
getWeather();
61+
printInfo();
62+
delay(1000);
63+
64+
}
65+
//---------------------------------------------------------------
66+
void getWeather()
67+
{
68+
// Measure Relative Humidity from the HTU21D or Si7021
69+
humidity = sensor.getRH();
70+
71+
// Measure Temperature from the HTU21D or Si7021
72+
tempf = sensor.getTempF();
73+
// Temperature is measured every time RH is requested.
74+
// It is faster, therefore, to read it from previous RH
75+
// measurement with getTemp() instead with readTemp()
76+
}
77+
//---------------------------------------------------------------
78+
void printInfo()
79+
{
80+
//This function prints the weather data out to the default Serial Port
81+
82+
Serial.print("Temp:");
83+
Serial.print(tempf);
84+
Serial.print("F, ");
85+
86+
Serial.print("Humidity:");
87+
Serial.print(humidity);
88+
Serial.println("%");
89+
}

examples/Standard_code_header.c

Lines changed: 0 additions & 26 deletions
This file was deleted.

keywords.txt

100755100644
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#######################################
2+
# Datatypes (KEYWORD1)
3+
#######################################
4+
5+
Weather KEYWORD1
6+
7+
#######################################
8+
# Methods and Functions (KEYWORD2)
9+
#######################################
10+
11+
getRH KEYWORD2
12+
readTemp KEYWORD2
13+
getTemp KEYWORD2
14+
readTempF KEYWORD2
15+
getTempF KEYWORD2
16+
heaterOn KEYWORD2
17+
heaterOff KEYWORD2
18+
changeResolution KEYWORD2
19+
Reset KEYWORD2
20+
checkID KEYWORD2
21+
#######################################
22+
# Constants (LITERAL1)
23+
#######################################
24+
25+
26+
ADDRESS LITERAL1
27+
28+
TEMP_MEASURE_HOLD LITERAL1
29+
HUMD_MEASURE_HOLD LITERAL1
30+
TEMP_MEASURE_NOHOLD LITERAL1
31+
HUMD_MEASURE_NOHOLD LITERAL1
32+
TEMP_PREV LITERAL1
33+
34+
WRITE_USER_REG LITERAL1
35+
READ_USER_REG LITERAL1
36+
SOFT_RESET LITERAL1
37+
HTRE LITERAL1
38+
CRC_POLY LITERAL1
39+

library.properties

100755100644
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=<LIBRARY NAME>
2-
version=<Major.Minor.Patch>
3-
author=NAME <EMAIL>
1+
name=SparkFun Si7021 Humidity and Temperature Sensor
2+
version=1.0.0
3+
author=Joel@SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
5-
sentence=<ONE SENTENCE DESCRIPTION>
6-
paragraph=<FULL LIBRARY DESCRIPTION>
7-
category=<>
8-
url=<GITHUB URL>
9-
architectures=<>
5+
sentence=Library for Si7021 Humidity and Temperature Sensor.
6+
paragraph=Library for Si7021 Humidity and Temperature Sensor.
7+
category=Sensors
8+
url=https://github.com/sparkfun/Si7021_Breakout
9+
architectures=*

0 commit comments

Comments
 (0)