LCD 16x2 HD44780 and BMP085 pressure sensor problem

It looks like your separate SCL/SDA pins on the Leonardo are just hard-wired to pins 2/3.

... yes, they are hard-wired. No idea why they did that though...

It has to do with the fact that the Arduino team decided to simplify things by using a linear series of numbers for all of the I/O pins rather than using the more standard technique of putting the I/O pins in groups called 'ports'.

When the (predecessor for the) ATmega328 was designed the SDA pin was connected to PC4 (pin 4 of Port C) and the SCL pin was connected to PC5 (pin 5 of Port C).

Using the Arduino numbering scheme the SDA pin (on PC4) wound up on Arduino pin A4 and the SCL pin (on PC5) wound up on Arduino pin A5.

Now along came the Leonardo which uses a different Atmel chip, the ATmega32u4. Since this chip has a different pinout from the ATmega328 it cannot be a plug-in replacement for the 328 and therefore there was no need to keep the specialized I/O functions such as SDA and SCL on the same pins.

On the ATmega32u4 the SDA pin wound up on PD1 and the SCL pin wound up on PD0.

On the Leonardo PD1 is called D1 so this is where SDA wound up, and PD0 is called D0 so this is where SCL wound up.

I hope I kept all of the numbers straight, but you should get the idea even if I didn't.

Don

Thanks for that Floresta. That explains why the pins keep moving on different boards.

Do you know why they duplicated the pins above the digital pins on the Leonardo?

Do you know why they duplicated the pins above the digital pins on the Leonardo?

There is an explanation on the page for the Arduino UNO. Look in the paragraph for 'Revision 3' at http://arduino.cc/en/Main/arduinoBoardUno.

Don

Hi,

New to arduino, have exact same setup but code fails compile at sensors_event_t event;

Window at bottom In file included from sketch_jun17a.ino:8: H:\Documents\Arduino\libraries\Adafruit_BMP085/Adafruit_BMP085_U.h:100: error: expected class-name before '{' token H:\Documents\Arduino\libraries\Adafruit_BMP085/Adafruit_BMP085_U.h:109: error: 'sensors_event_t' has not been declared H:\Documents\Arduino\libraries\Adafruit_BMP085/Adafruit_BMP085_U.h:110: error: 'sensor_t' has not been declared sketch_jun17a.ino: In function 'void loop()': sketch_jun17a:33: error: 'sensors_event_t' was not declared in this scope sketch_jun17a:33: error: expected `;' before 'event' sketch_jun17a:34: error: 'event' was not declared in this scope

I reckon there is a problem with the BMP085 api, but not too sure

I took code pasted on page one and loaded the libraries as instructed !

Any help ?

Ta