Hi there,
I have a due with a spi tft screen attached there is also a RTC hooked up and there are als two ds1820 hooked to the board.
When i run a example scetch for the one wire temperature it is fine.
when i run my sketch i don't get any temperature reading.
below is my code:
// UTFT_Demo_320x240
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of how to use most of the functions
// of the library with a supported display modules.
//
// This demo was made for modules with a screen resolution
// of 320x240 pixels.
//
// This program requires the UTFT library.
//
#include <UTFT.h>
#include <DS3231.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define TFTcs PIN_SPI_SS0 //CS - CE (pin 77)
#define TFTsclk PIN_SPI_SCK //hw SPI - SCK (pin 76)
#define TFTmosi PIN_SPI_MOSI //hw SPI - SDA - DIN (pin 75)
#define TFTdc 49 //A0 - DC - RS - D/C
#define TFTrst 48 //RESET
#define ONE_WIRE_BUS A6
#define TEMPERATURE_PRECISION 9
// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Init a Time-data structure
Time t;
String test;
String temp;
// Declare which fonts we will be using
extern uint8_t SmallFont[];
// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Arduino Uno / 2009:
// -------------------
// Standard Arduino Uno/2009 shield : <display model>,A5,A4,A3,A2
// DisplayModule Arduino Uno TFT shield : <display model>,A5,A4,A3,A2
//
// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
// UTFT(byte model, int RS, int WR, int CS, int RST, int SER=0);
//UTFT myGLCD(CTE32,25,26,27,28);
UTFT myGLCD(TFT01_18SP,TFTmosi,TFTsclk,TFTcs,TFTrst,TFTdc);
void setup()
{
randomSeed(analogRead(0));
// Initialize the rtc object
sensors.begin();
rtc.begin();
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
// Clear the screen and draw the frame
myGLCD.clrScr();
myGLCD.setColor(255, 255, 255);
myGLCD.print("Tijd :", LEFT, 1);
myGLCD.print("Dak :", LEFT, 20);
myGLCD.print("Water :", LEFT, 30);
myGLCD.print("Inloop :", LEFT, 40);
}
void loop()
{
t = rtc.getTime();
test = " " + String(t.hour) + ":" + String(t.min) + ":" +String(t.sec) ;
myGLCD.print(test, RIGHT,1);
sensors.requestTemperatures(); // Send the command to get temperatures
temp = String(sensors.getTempCByIndex(0));
myGLCD.print(temp , RIGHT, 20);
delay (1000);
}