I am having a problem interfacing a Bmp180 into a clock program, without the Bmp180 clock functions as it should, adding the program of the Bmp180 clock stops and Bmp180 keeps working displaying Temp, Press, Alt, and Atm and a non functioning clock and no Date or Day.
I have pullup resistors (4.7k) on the Sda and Scl lines of the Bmp180 and Ds3231 into a Mega2560 and a 480x320 Tft Lcd.
The same clock program with a Dht11 works as it should, Time, Date, Day, Temp, and Humi.
Is there a problem interfacing the Bmp180 and Ds3231, or is there a part of the program I have missed.
I have enclosed the program as is at the moment.
Any advice will be of great help.
#include "Wire.h"
#include <DS1307.h> // link library DS1307
#include <UTFT.h> // link library UTFT
#include "Barometer.h"
//#define DS1307_I2C_ADDRESS 0x68
DS1307 rtc (20, 21); // Initialize inputs
float temperature;
float pressure;
float atm;
float altitude;
Barometer myBarometer;
extern uint8_t BigFont []; // Connect the font DotMatrix_M
extern uint8_t SevenSeg_XXXL_Num []; // Connect the font SevenSeg_XXXL_Num
extern uint8_t SmallFont[];
UTFT myGLCD (CTE32HR, 38,39,40,41); // Connect the display TFT01_22SP
void setup ()
{
//rtc.setTime(15, 36, 00);
//rtc.setDate(05, 04, 2015);
//rtc.setDOW(SUNDAY);
rtc.halt (false); // Start the clock
Serial.begin(9600);
myBarometer.init();
myGLCD.InitLCD (); // Initialize the display
myGLCD.setFont(BigFont);
myGLCD.fillScr (0, 0, 0); // Paint over the display in black
}
void loop ()
{
String stringOne = rtc.getTimeStr ();
myGLCD.setColor (255, 255, 255); // Display color
myGLCD.setFont (SevenSeg_XXXL_Num); // Font to display
myGLCD.print (stringOne.substring (0,2), 02, 60); // Display the clock
myGLCD.print (stringOne.substring (3,5), 150, 60); // Display the minute
myGLCD.print (stringOne.substring (6,8), 310, 60); // Display the minute
myGLCD.fillCircle (140, 88, 7); // The top point
myGLCD.fillCircle (140, 133, 7); // Low Point
myGLCD.fillCircle (295, 88, 7); // 2nd top point
myGLCD.fillCircle (295, 133, 7); // 2nd Low Point
myGLCD.setColor (0, 255, 0); // Display color
myGLCD.setFont (BigFont); // Font to display
myGLCD.print (rtc.getDateStr (), 120, 260); // Display the date
myGLCD.print(rtc.getDOWStr(), 133, 290); // Display the day
temperature = myBarometer.bmp085GetTemperature(myBarometer.bmp085ReadUT()); //Get the temperature, bmp085ReadUT MUST be called first
pressure = myBarometer.bmp085GetPressure(myBarometer.bmp085ReadUP()); //Get the temperature
altitude = myBarometer.calcAltitude(pressure); //Uncompensated calculation - in Meters
atm = pressure / 101325;
myGLCD.setColor(255, 0, 0); //Red
myGLCD.setFont (SmallFont); // Font to display
myGLCD.print ("Temp: ", 30, 170);
myGLCD.setColor(255, 255, 0); //Yellow
myGLCD.setFont (BigFont);
myGLCD.printNumF (temperature,2, 70,170);
myGLCD.setFont (BigFont);
myGLCD.print ("C", 160, 170);
myGLCD.setColor(255, 0, 0); //Red
myGLCD.setFont (SmallFont); // Font to display
myGLCD.print("Press:", 190, 170);
myGLCD.setColor(255, 255, 0); //Yellow
myGLCD.setFont (BigFont);
myGLCD.printNumF (pressure,2, 240,170);
myGLCD.setFont (BigFont);
myGLCD.print ("Pa", 390, 170);
myGLCD.setColor(255, 0, 0); //Red
myGLCD.setFont (SmallFont); // Font to display
myGLCD.print ("Atmos: ", 30, 200);
myGLCD.setColor(255, 255, 0); //Yellow
myGLCD.setFont (BigFont);
myGLCD.printNumF (atm,2, 80,200);
myGLCD.setColor(255, 0, 0); //Red
myGLCD.setFont (SmallFont); // Font to display
myGLCD.print ("Alt: ", 160, 200);
myGLCD.setColor(255, 255, 0); //Yellow
myGLCD.setFont (BigFont);
myGLCD.printNumF (altitude,2, 195,200);
myGLCD.setFont (BigFont);
myGLCD.print ("m", 285, 200);
}