ASensor
 All Classes Functions Pages
BMP085Sensor.h
1 #pragma once
2 /*
3  ASensor - Sensor library. Can be used standalone or in conjunction with AWind library
4  Copyright (C)2015 Andrei Degtiarev. All right reserved
5 
6  You can always find the latest version of the library at
7  https://github.com/AndreiDegtiarev/ASensor
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the MIT license.
11  Please see the included documents for further information.
12 */
14 class BMP085Sensor : public ISensor
15 {
16 #ifndef DEMO_SENSORS
17  Adafruit_BMP085_Unified *_bmp ;
18 #endif
19 public:
20  BMP085Sensor()
21  /* :ISensor(10085,
22  700,
23  1300,
24  700,
25  1300,
26  0,pause_length)*/
27  {
28 #ifndef DEMO_SENSORS
29  _bmp = new Adafruit_BMP085_Unified(10085);
30  if(!_bmp->begin())
31  {
32  /* There was a problem detecting the BMP085 ... check your connections */
33  Serial.print(F("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!"));
34  }
35 #endif
36  }
37  virtual const __FlashStringHelper* Name()
38  {
39  return F("BMP085");
40  }
41  virtual float LowMeasurementLimit()
42  {
43  return 700;
44  }
45  virtual float HighMeasurementLimit()
46  {
47  return 1300;
48  }
49  virtual int Precission()
50  {
51  return 0;
52  }
53  virtual bool Measure(float &data)
54  {
55 #ifdef DEMO_SENSORS
56  data=(float)rand()/RAND_MAX*100+1000;
57  return true;
58 #else
59  sensors_event_t event;
60  _bmp->getEvent(&event);
61  if (event.pressure)
62  {
63  data=event.pressure;
64 #ifdef DEBUG_AWIND
65  out<<F("Pressure: ")<<data<<endln;
66 #endif
67  return true;
68  }
69  return false;
70 #endif
71  }
72 };
Wrapper for BMP085 air pressure sensor. To use this sensor Adafruit_BMP085_Unified library has to be ...
Definition: BMP085Sensor.h:14