I'm using an Arduino Nano and intend to use it as the outside bit of my weather station.
I will be adding a wind direction and speed sensor once they arrive and I've worked it all out.
However for the moment I have a BME280 temp, humidity and pressure sensor connected and using the "sketch?" below it works fine
I got the sketch from the Sparkfun BME280 library and I am using it in I2C mode
I modified the sketch by removing the measurements I didn't want or need, and I put in a ° symbol instead of using the word "Degrees"
I cannot get it to start when I power up the Arduino Nano, it will only start if I reupload the sketch to the Nano but if I disconnect it - I get nothing
Anyone got any ideas?
The sketch is below
/******************************************************************************
I2C_and_SPI_Multisensor.ino
BME280 Arduino and Teensy example
Marshall Taylor @ SparkFun Electronics
May 20, 2015
https://github.com/sparkfun/SparkFun_BME280_Arduino_Library
This sketch configures two BME280 breakouts. One is configured as I2C and
the other as SPI. Data from both are displayed.
Sensor A is I2C and connected through A4 and A5 (SDA/SCL)
Sensor B is SPI and connected through pins 10, 11, 12, and 13 through a
level shifter, with pin 10 being used for chip select.
Resources:
Uses Wire.h for I2C operation
Uses SPI.h for SPI operation
Development environment specifics:
Arduino IDE 1.6.4
Teensy loader 1.23
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
Please review the LICENSE.md file included with this example. If you have any questions
or concerns with licensing, please contact techsupport@sparkfun.com.
Distributed as-is; no warranty is given.
******************************************************************************/
#include <stdint.h>
#include "SparkFunBME280.h"
#include "Wire.h"
#include "SPI.h"
//Global sensor object
BME280 mySensorA;
void setup()
{
//***Set up sensor 'A'******************************//
//commInterface can be I2C_MODE or SPI_MODE
mySensorA.settings.commInterface = I2C_MODE;
mySensorA.settings.I2CAddress = 0x77;
mySensorA.settings.runMode = 3; // 3, Normal mode
mySensorA.settings.tStandby = 0; // 0, 0.5ms
mySensorA.settings.filter = 0; // 0, filter off
//tempOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
mySensorA.settings.tempOverSample = 1;
//pressOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
mySensorA.settings.pressOverSample = 1;
//humidOverSample can be:
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
mySensorA.settings.humidOverSample = 1;
//***Initialize the things**************************//
delay(2000);
Serial.begin(9600);
Serial.print("Program Started\n");
Serial.println("Starting BME280s... result of .begin():");
delay(10); //Make sure sensor had enough time to turn on. BME280 requires 2ms to start up.
//Calling .begin() causes the settings to be loaded
Serial.print("Sensor A: 0x");
Serial.println(mySensorA.begin(), HEX);
}
void loop()
{
//Start with temperature, as that data is needed for accurate compensation.
//Reading the temperature updates the compensators of the other functions
//in the background.
Serial.print("Temperature: ");
Serial.print(mySensorA.readTempC(), 2);
Serial.print((char)178); // degree symbol
Serial.println("C"); // C character
Serial.print("Pressure: ");
Serial.print(mySensorA.readFloatPressure(), 2);
Serial.println(" Pa");
Serial.print("Altitude: ");
Serial.print(mySensorA.readFloatAltitudeMeters(), 2);
Serial.println("m");
Serial.print("Altitude: ");
Serial.print(mySensorA.readFloatAltitudeFeet(), 2);
Serial.println("ft");
Serial.print("%RH: ");
Serial.print(mySensorA.readFloatHumidity(), 2);
Serial.println(" %");
Serial.println();
delay(1000);
}