I am new to arduino and still trying hard to learn the basics.
I am making a touchscreen temperature sensor for my boats control panel. I have made good progress so far although I am stumped at the following -
I have managed to display the date and time from the DS3231 on my 4.3 sainsmart with no problems although I cant seem to display the reading from the onboard temperature sensor in the same way.
It is printing in serial monitor with no problems but I just cant seem to display this info on my tft.
I am using the command : -
myGLCD.print(rtc.getTemp(), 180, 78);
which just results in a compiling error.
As stated I can display the time and date no problem with similar commands : -
myGLCD.print(rtc.getDateStr(), 355, 73);
myGLCD.print(rtc.getDOWStr(), 60, 73);
myGLCD.setColor (255,255,255);
myGLCD.setFont(BigFont);
myGLCD.print(rtc.getTimeStr(), 180, 71);
As i say I am a complete beginner and I have probably made a schoolboy error, can someone please point out what I am missing and put me out my misery
Is also my first post so I hope I have uploaded my sketch properly. edit - I tried posting my code using the code command but just displays a blank scroll box
Im sorry to have to include my sketch in this way
#include <DS3231.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_tinyFAT.h>
#include <tinyFAT.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
char* files480[]={"pic998.RAW, pic1000.RAW"};
char* files[10];
int picsize_x, picsize_y;
word res;
long sm, em;
UTFT myGLCD(ITDB43,38,39,40,41);
UTFT_tinyFAT myFiles(&myGLCD);
DS3231 rtc(SDA, SCL);
UTouch myTouch( 6, 5, 4, 3, 2);
void setup()
{
Serial.begin(115200);
myGLCD.InitLCD();
file.initFAT();
rtc.begin();
myTouch.setPrecision(PREC_MEDIUM);
myTouch.InitTouch();
myGLCD.setColor(255,255,255);
myGLCD.setFont(SmallFont);
picsize_x=myGLCD.getDisplayXSize();
picsize_y=myGLCD.getDisplayYSize();
switch (picsize_x)
{
for (int z=0; z<sizeof(files480)/sizeof(*files480);z++)
files[z] = files480[z];
}
}
void loop()
{
int buf[478];
int x, x2;
int y, y2;
int r;
int var = 0;
// DRAW THE PATTERN AND LOGO
myGLCD.clrScr();
myGLCD.setColor (255,0,0);
for (int i=15; i<256; i+=5)
{
myGLCD.drawLine(1, i, (i1.88)-10, 256);
}
myGLCD.setColor (255,0,0);
for (int i=256; i>15; i-=5)
{
myGLCD.drawLine(478, i, (i1.88)-11, 15);
}
myGLCD.setColor (0,255,255);
for (int i=256; i>15; i-=5)
{
myGLCD.drawLine(1, i, 491-(i1.88), 15);
}
myGLCD.setColor (0,255,255);
for (int i=15; i<256; i+=5)
{
myGLCD.drawLine(478, i, 490-(i1.88), 256);
}
{
res=myFiles.loadBitmap(75, 105, 330, 60, "pic1000.RAW");
}
delay(5000);
myGLCD.clrScr();
// DRAW THE MAIN SCREEN
{
myGLCD.setBackColor (0,0,0);
res=myFiles.loadBitmap(0, 0, picsize_x, picsize_y, "pic998.RAW");
while(var < 200)
{
// DRAW TIME, DAY & DATE
myGLCD.setFont(SmallFont);
myGLCD.setColor (255,255,255);
//myGLCD.print(rtc.getTemp(), 180, 78);
myGLCD.print(rtc.getDateStr(), 355, 73);
myGLCD.print(rtc.getDOWStr(), 60, 73);
myGLCD.setColor (255,255,255);
myGLCD.setFont(BigFont);
myGLCD.print(rtc.getTimeStr(), 180, 71);
{
// SEND TEMPRATURE TO SERIAL MONITOR
Serial.print("Temperature: ");
Serial.print(rtc.getTemp());
Serial.println(" C");
}
}}}