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.