Problems using BMP180 with TFT screen

Hi Guys,

I have downloaded a library for my tft screen and written code to display information successfully. I have also downloaded a library for the BMP180 and the example code works perfectly sending data to the serial monitor but when I try to put them both together, there's a clash and the tft screen just goes blank at the first call to the bmp180.

Bothe libraries are from adafruit. The screen I have is a '2.4" TFT LCD SHIELD' from eBay and on the underside, it shows which pins are in use and the I2C pins do not have anything written against them.

So, here's the code. It works as is, but when I uncomment either line which calls bmp, it runs OK to that point, then the screen goes blank.

#include <SPFD5408_Adafruit_GFX.h> // Core graphics library
#include <SPFD5408_Adafruit_TFTLCD.h> // Hardware-specific library
#include <Adafruit_BMP085.h>
#include <Wire.h>

Adafruit_BMP085 bmp;

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup(void)
{
bmp.begin();
tft.reset();
tft.begin(0x9341); // SDFP5408
tft.setRotation(3);
tft.fillScreen(BLACK);
tft.setCursor(0, 0);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.println(" Steve's Barometer");
tft.setCursor(35, 70);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.print("Pres :");
tft.setCursor(35, 135);
tft.print("Temp :");
tft.setCursor(20, 220);
tft.setTextSize(1);
tft.setTextColor(WHITE);
tft.print("TFT Barometer, Steve Ferry 2016, www.efftek.co.uk");
}

void loop(void)
{
tft.setTextSize(3);
tft.setCursor(185, 70);
tft.setTextColor(GREEN,BLACK);
//tft.println(bmp.readPressure());
tft.setCursor(185, 135);
//tft.println(bmp.readTemperature());
delay(1000);
}

Any ideas?
Steve.

This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor

Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout
----> BMP085 Barometric Pressure/Temperature/Altitude Sensor- 5V ready : ID 391 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> BMP180 Barometric Pressure/Temperature/Altitude Sensor- 5V ready : ID 1603 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

These displays use I2C to communicate

Which 2 pins? It is necessary that YOU learn which two pins, and how to determine when you have pin conflicts.

PaulS:
Which 2 pins? It is necessary that YOU learn which two pins, and how to determine when you have pin conflicts.

The pins I refer to are the ones marked on the Uno (sorry didn't mention which board) as SCL and SDA ie the I2C pins. The TFT board isn't even connected to these pins. Without even having a BMP180 connected, the TFT crashes out. Is this a pin conflict or a software conflict?

The TFT board isn't even connected to these pins.

Then why do you have:

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

PaulS:
Then why do you have:

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

Paul, underneath my name, it says 'Newbie' does it not?

The less condescending answer would be that the A4 and A5 pins which the tft board IS connected to are the same pins as the SDA and SCL I2C pins near the Uno's USB socket which the tft isn't connected to. As a 'Newbie' I might have thanked you for pointing that out and give you some Kleos (Sorry if you don't speak ancient Greek, you'll just have to find that out for yourself)

However, you have pointed me in the right direction. I think I'll try commenting out that line and see what happened.

ευχαριστώ

Steve.

Paul, underneath my name, it says 'Newbie' does it not?

All that means is that you have made fewer than 100 posts in this forum. It tells us nothing about how much coding experience you have.

I told you, in the first reply, that you needed to understand what pins are used for what, so that you don't try to use any pin for two different purposes.

I could have said "You can't use pin A4 or A5 for that...", but you would not have learned why. You could then have tried to use pins 10, 11, and 12, after adding an Ethernet shield, and not have had a clue as to why THAT didn't work.

By making YOU study the data sheets and pin usage in the code, I made you learn something. If that frosted you for some reason, I'm sorry.