Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 8 months ago.
BMP085 problem, code wont run.
I want to measure air pressure using a BMP085 as described here http://mbed.org/users/okini3939/notebook/barometric-pressure-sensor-bmp085/?c=5282. I found this example
#include "mbed.h" #include "BMP085.h" BMP085 bmp085(p9, p10); DigitalOut myled(LED1); Serial pc(USBTX, USBRX); int main() { float p, t; while(1) { myled = 1; bmp085.update(); p = bmp085.get_pressure(); t = bmp085.get_temperature(); pc.printf("p:%6.2f hPa / t:%6.2f C\n", p, t); myled = 0; wait(3); } }
I ussually copy line by line to my program and compile. After I added
BMP085 bmp085(p9, p10);
my code wont run anymore. Anyone has an idea?
EDIT 20-3-2013: I copied and paste the code again into my program and guess what... this time it normally runs.Weird.
2 Answers
11 years, 8 months ago.
Hmmm that's weird, I copied and pasted the code again into my program, and guess what, now the code runs normally.
11 years, 8 months ago.
When asking questions you really need to supply all the relevant information, In this case at least the compiler error would be nice.
anyway the class BMP085 seems to be derived from a class called Base, I couldn't see anything in the class that even relies on that base class so I changed the line:
class BMP085 : public Base {
to
class BMP085 {
and it compiled without complaint, I'm afraid I don't have the hardware to check it works though.
Just wondering if this helped you? and if it did could you mark it as solved?
posted by Chris Pepper 06 Mar 2013