Skip to content

Commit 979b2ff

Browse files
committedMar 24, 2018
Comment changes to examples
1 parent 12e754d commit 979b2ff

File tree

7 files changed

+20
-38
lines changed

7 files changed

+20
-38
lines changed
 

‎examples/Example1_BasicReadings/Example1_BasicReadings.ino

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
https://www.sparkfun.com/products/13676 - BME280 Breakout Board
1111
1212
This example shows how to read humidity, pressure, and current temperature from the BME280 over I2C.
13-
14-
todo
15-
example set local ref pressure
16-
fix repo description
17-
example of reading/writing cal factors
18-
1913
*/
2014

2115
#include "Wire.h"
@@ -26,14 +20,13 @@ BME280 mySensor; //Global sensor object
2620
void setup()
2721
{
2822
Serial.begin(9600);
29-
while(!Serial);
3023
Serial.println("Reading basic values from BME280");
3124

3225
Wire.begin();
3326

3427
if (mySensor.beginI2C() == false) //Begin communication over I2C
3528
{
36-
Serial.println("The chip did not respond. Please check wiring.");
29+
Serial.println("The sensor did not respond. Please check wiring.");
3730
while(1); //Freeze
3831
}
3932
}

‎examples/Example3_CSVOutput/Example3_CSVOutput.ino

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
Feel like supporting our work? Buy a board from SparkFun!
1111
https://www.sparkfun.com/products/14348 - Qwiic Combo Board
1212
https://www.sparkfun.com/products/13676 - BME280 Breakout Board
13-
14-
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
15-
Please review the LICENSE.md file included with this example. If you have any questions
16-
or concerns with licensing, please contact techsupport@sparkfun.com.
17-
Distributed as-is; no warranty is given.
1813
*/
1914

2015
#include "Wire.h"
@@ -32,7 +27,7 @@ void setup()
3227

3328
if (mySensor.beginI2C() == false) //Begin communication over I2C
3429
{
35-
Serial.println("The chip did not respond. Please check wiring.");
30+
Serial.println("The sensor did not respond. Please check wiring.");
3631
while(1); //Freeze
3732
}
3833

‎examples/Example5_ReadAllRegisters/Example5_ReadAllRegisters.ino

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/******************************************************************************
1+
/*
22
Read all the regigsters of the BME280
33
BME280 Arduino and Teensy example
44
Marshall Taylor @ SparkFun Electronics
@@ -14,7 +14,6 @@
1414
This sketch configures the BME280 to read all measurements. The sketch also
1515
displays the BME280's physical memory and what the driver perceives the
1616
calibration words to be.
17-
1817
*/
1918

2019
#include "Wire.h"
@@ -25,18 +24,17 @@ BME280 mySensor; //Global sensor object
2524
void setup()
2625
{
2726
Serial.begin(9600);
27+
while(!Serial); //Needed for printing correctly when using a Teensy
2828
Serial.println("Reading all registers from BME280");
2929

3030
Wire.begin();
3131

3232
if (mySensor.beginI2C() == false) //Begin communication over I2C
3333
{
34-
Serial.println("The chip did not respond. Please check wiring.");
34+
Serial.println("The sensor did not respond. Please check wiring.");
3535
while (1); //Freeze
3636
}
3737

38-
Serial.print("Displaying ID, reset and ctrl regs\n");
39-
4038
Serial.print("ID(0xD0): ");
4139
printyPrintHex(mySensor.readRegister(BME280_CHIP_ID_REG));
4240

@@ -52,19 +50,21 @@ void setup()
5250
Serial.println();
5351

5452
Serial.println("Displaying all regs:");
55-
uint8_t memCounter = 0x80;
56-
uint8_t tempReadData;
57-
for (int rowi = 8 ; rowi < 16 ; rowi++)
53+
byte memCounter = 0x80;
54+
for (byte row = 8 ; row < 16 ; row++)
5855
{
5956
Serial.print("0x");
60-
Serial.print(rowi, HEX);
57+
Serial.print(row, HEX);
6158
Serial.print("0:");
62-
for (int coli = 0 ; coli < 16 ; coli++)
59+
60+
for (byte column = 0 ; column < 16 ; column++)
6361
{
64-
tempReadData = mySensor.readRegister(memCounter);
65-
Serial.print((tempReadData >> 4) & 0x0F, HEX);//Print first hex nibble
66-
Serial.print(tempReadData & 0x0F, HEX);//Print second hex nibble
62+
byte tempReadData = mySensor.readRegister(memCounter);
63+
64+
if(tempReadData < 0x10) Serial.print("0");
65+
Serial.print(tempReadData, HEX);
6766
Serial.print(" ");
67+
6868
memCounter++;
6969
}
7070
Serial.println();

‎examples/Example7_RelativeAltitudeChange/Example7_RelativeAltitudeChange.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void setup()
6666

6767
if (mySensor.beginI2C() == false) //Begin communication over I2C
6868
{
69-
Serial.println("The chip did not respond. Please check wiring.");
69+
Serial.println("The sensor did not respond. Please check wiring.");
7070
while (1); //Freeze
7171
}
7272

‎keywords.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ writeRegister KEYWORD2
2626

2727
beginI2C KEYWORD2
2828
setFilter KEYWORD2
29-
setStandByTime KEYWORD2
29+
setStandbyTime KEYWORD2
3030
setMode KEYWORD2
3131
getMode KEYWORD2
3232
setTempOverSample KEYWORD2
3333
setPressureOverSample KEYWORD2
34-
setHumidtyOverSample KEYWORD2
34+
setHumidityOverSample KEYWORD2
3535
setI2CAddress KEYWORD2
3636
isMeasuring KEYWORD2
3737
setReferencePressure KEYWORD2

‎library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun BME280
2-
version=2.0.0
2+
version=2.0.1
33
author=SparkFun Electronics
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=A library to drive the Bosch BME280 Altimeter and Pressure sensor

‎src/SparkFunBME280.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,9 @@ uint8_t BME280::begin()
144144
bool BME280::beginI2C(TwoWire &wirePort)
145145
{
146146
settings.I2CPort = &wirePort;
147-
148147
settings.commInterface = I2C_MODE;
149148
//settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()
150-
149+
151150
if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60
152151
return(false);
153152
}
@@ -361,8 +360,6 @@ float BME280::getReferencePressure()
361360
return(_referencePressure);
362361
}
363362

364-
365-
366363
float BME280::readFloatAltitudeMeters( void )
367364
{
368365
float heightOutput = 0;
@@ -405,11 +402,8 @@ float BME280::readFloatHumidity( void )
405402
var1 = (var1 > 419430400 ? 419430400 : var1);
406403

407404
return (float)(var1>>12) / 1024.0;
408-
409405
}
410406

411-
412-
413407
//****************************************************************************//
414408
//
415409
// Temperature Section

0 commit comments

Comments
 (0)
Please sign in to comment.