Author Topic: Wiring BMP085 Pressure Sensor Code errors?  (Read 4379 times)

0 Members and 1 Guest are viewing this topic.


Wiring BMP085 Pressure Sensor Code errors?
« on: October 13, 2014, 11:12:15 PM »
Hi Guys,
I am a complete 'newbie' to this medium and relatively newbie to Arduino Uno platform and have downloaded the Wiring Code for the BMP085 and run it as is on my Uno.

The code seems to run OK but I am getting some very funny pressure readings back in the Serial Monitor which are of the order '178675' and since the BMP085 reports hPa for pressure these are nonsensical??? What pressure unit is being reported by your code - I am presuming that it is Pa and even if this is so it is not the correct magnitude (should be around 1013.00 hPa (101300 Pa) or so at standard sea leavel?

Additionally, at the bottom of the code the '8-bit code' has been commented out so I thought this might be the cause in that the code is running on 16 bit and not 8-bit (a pure guess on my part) and so I uncommented out the 8-bit and commented out the 16-bit code and then ran it but then ran into all sorts of coding problems with this part of the code!

In my limited experience I can see that the "wire.send() and wire.available()
codes do not appear in your reference code terms and it is these specific terms that the Uno compiler baulks at and throws a number of errors at their inclusion!! I did try substituting Read & Write where I thought they were appropriate but all to no avail!!!

Now I am very much out of my depth - so I would appreciate any help on sorting out this dilemma, please: Refer offending code below


unsigned char readRegister(unsigned char r)
  unsigned char v;
  Wire.send(r);  // register to read

  Wire.requestFrom(I2C_ADDRESS, 1); // request a byte
  while(!Wire.available()); // wait until data available
  v = Wire.receive();
  return v;

Also, to the site administrators may I suggest that the security code is made a tad larger so it can be easily read when registering on your site - I had to change it 8 times and even using a magnifying glass to discern the actual characters.

Cheers, IanB


Re: Wiring BMP085 Pressure Sensor Code errors?
« Reply #1 on: October 13, 2014, 11:28:31 PM »
Sorry Guys - the 'wire.available()' is OK and I should have said it was wire.receive() and wire.send() that is causing the coding problems on Uno!

Cheers, IanB