Commit 2b8b88d4 authored by Markéta Jedličková's avatar Markéta Jedličková
Browse files

Issue #3 fixed, BME and BMP correctly added into PRO and LITE

parent b0a78456
......@@ -34,10 +34,6 @@
// BMP280 constants
#define BMP280_ADDRESS_OPEN_CANSAT 0x76
// BME280 constants
#define BME280_ADDRESS_OPEN_CANSAT 0x77
#define SEALEVELPRESSURE_HPA 1013.25
// SD card constants
#define sd_cs_pin 35 // set SD's chip select pin (according to the circuit)
......
......@@ -19,7 +19,6 @@
#include "Arduino.h"
#include <Adafruit_BME280.h> // include Adafruit BME280 library
#include <Adafruit_BMP280.h> // include Adafruit BMP280 library
#include <Adafruit_INA219.h> // include INA219
#include <SD.h> // include Arduino SD library
#include "Open_Cansat_GPS.h"
......@@ -41,9 +40,6 @@
#define CHIP_SELECT_PIN 43 //radio chip select
#define INTERUP_PIN 9 //radio interrupt
// BMP280
#define BMP280_ADDRESS_OPEN_CANSAT 0x76
// BME280 SETTING
#define BME280_ADDRESS_OPEN_CANSAT 0x77
#define SEALEVELPRESSURE_HPA 1013.25
......@@ -81,10 +77,6 @@ typedef struct
messageOut data; //create the struct variable
// create object 'bmp' from the library, which will
// be used to access the library methods by a dot notation
Adafruit_BMP280 bmp;
// create object 'bme' from the library, which will
// be used to access the library methods by a dot notation
Adafruit_BME280 bme;
......@@ -107,7 +99,6 @@ File file; // SD library variable
// Local variables
int idCounter = 1;
bool isBmeOk = true;
bool isBmpOk = true;
bool isSdOk = true;
bool isRadioOk = true;
bool isGpsConnected = true;
......@@ -122,21 +113,12 @@ void setup()
// COMMENT OUT FOR USAGE WITHOUT A PC!
// while(!Serial);
Serial.println("openCanSat LITE");
Serial.println("openCanSat PRO");
Serial.print("Node ");
Serial.print(MYNODEID,DEC);
Serial.println(" ready");
// begin communication with the BMP280 on the previously specified address
// print an error to the serial in case the sensor is not found
if (!bmp.begin(BMP280_ADDRESS_OPEN_CANSAT))
{
isBmpOk = false;
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
return;
}
// begin communication with the BME280 on the previously specified address
// print an error to the serial in case the sensor is not found
if (!bme.begin(BME280_ADDRESS_OPEN_CANSAT))
......@@ -187,13 +169,6 @@ void loop()
data.pressure = 0;
data.altitude = 0;
if(isBmpOk)
{
data.temperature += bmp.readTemperature();
data.pressure += bmp.readPressure();
data.altitude += bmp.readAltitude(SEALEVELPRESSURE_HPA);
}
if(isBmeOk)
{
data.temperature += bme.readTemperature();
......@@ -202,13 +177,6 @@ void loop()
data.humidity_bme280 = bme.readHumidity();
}
if(isBmpOk and isBmeOk)
{
data.temperature /= 2;
data.pressure /= 2;
data.altitude /= 2;
}
Serial.println("Temperature = " + static_cast<String>(data.temperature) + " *C");
Serial.println("Pressure = " + static_cast<String>(data.pressure) + " Pa");
Serial.println("Approx altitude = " + static_cast<String>(data.altitude) + " m");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment