Hi Guys,
All I'm trying to do is use the UTFT library to print a temperature reading from my MAX6675 thermocouple to a 5" UTFT screen using the UTFT.h library. Here is my code and the error I am getting:
// 5 Inch Screen Dimension: 800 x 480
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <max6675.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t Dingbats1_XL[];
extern uint8_t GroteskBold32x64[];
extern uint8_t hallfetica_normal[];
// GLOBAL VARIABLE DECLARATION
int thermoSO = 14;
int thermoCS = 15;
int thermoSCK = 16;
MAX6675 thermocouple(thermoSCK, thermoCS, thermoSO);
int vccPin = 17;
int gndPin = 18;
int xW, yW, xL, xR, yT, yB, margin;
int menuTemp, menuHumidity, menuSmoke, menuSettings, pressed_button, settingsColor, customColor1, customColor2, settingsPage, page = 1;
boolean ForC, DorN; // Fahrenheit or Celcius and Day or Night Settings
int countB; // border thickness
UTFT screen(CTE50,38,39,40,41);
UTouch touch(6,5,4,3,2);
UTFT_Buttons buttons(&screen, &touch);
// SPLASH PAGE
void splash() {
margin = 20;
xW = screen.getDisplayXSize(); // size of display
yW = screen.getDisplayYSize();
xL = margin; // size of background square
xR = xW - margin;
yT = margin;
yB = yW - margin;
screen.clrScr();
screen.setColor(VGA_LIME);
screen.fillRoundRect(xL, yT, xR, yB);
screen.setColor(VGA_BLACK);
screen.setFont(GroteskBold32x64);
for(countB = 1; countB < 5; countB++) {
screen.drawRoundRect((xL - countB), (yT - countB), (xR + countB), (yB + countB));
}
screen.setBackColor(VGA_TRANSPARENT);
screen.print("SMART STACK",CENTER,180);
screen.setFont(hallfetica_normal);
screen.print("THE SMART WAY TO BARBEQUE", CENTER, 290);
screen.setColor(VGA_LIME);
screen.setBackColor(VGA_BLACK);
delay(2000);
}
void menuButtons() {
buttons.setTextFont(hallfetica_normal);
menuTemp = buttons.addButton(0,430,199,50, "TEMP");
menuHumidity = buttons.addButton(201,430,199,50, "HUMIDITY");
menuSmoke = buttons.addButton(401,430,199,50, "SMOKE");
menuSettings = buttons.addButton(601,430,199,50, "SETTINGS");
buttons.enableButton(menuTemp);
buttons.enableButton(menuHumidity);
buttons.enableButton(menuSmoke);
buttons.enableButton(menuSettings);
buttons.drawButtons();
}
// PAGE 1 - TEMP
void page1() {
screen.clrScr();
buttons.deleteAllButtons();
menuButtons();
screen.setFont(hallfetica_normal);
screen.print("PIT 1", 15,15);
screen.print("PIT 2", 15,235);
screen.print("MEAT 1",690,15);
screen.print("MEAT 2",690,235);
screen.drawRoundRect(10,10,390,215);
screen.drawRoundRect(10,230,390,420);
screen.drawRoundRect(410,10,790,215);
screen.drawRoundRect(410,230,790,420);
screen.setFont(GroteskBold32x64);
float myNum = 1.243;
screen.print(myNum,125,90); // PIT 1
screen.print("256.5",525,90); // PIT 2
screen.print("189.5",125,295); // MEAT 1
screen.print("192.5",525,295); // MEAT 2
page = 1;
}
// PAGE 2 - HUMIDITY
void page2() {
screen.clrScr();
buttons.deleteAllButtons();
menuButtons();
screen.setFont(hallfetica_normal);
screen.print("PIT 1", 15,15);
screen.print("PIT 2", 15,235);
screen.print("MEAT 1",690,15);
screen.print("MEAT 2",690,235);
screen.drawRoundRect(10,10,390,215);
screen.drawRoundRect(10,230,390,420);
screen.drawRoundRect(410,10,790,215);
screen.drawRoundRect(410,230,790,420);
screen.setFont(GroteskBold32x64);
screen.print("250.5",125,90); // PIT 1
screen.print("256.5",525,90); // PIT 2
screen.print("189.5",125,295); // MEAT 1
screen.print("192.5",525,295); // MEAT 2
page = 2;
}
// PAGE 3 - SMOKE
void page3() {
screen.clrScr();
screen.print(" SMOKE MONITOR",RIGHT, 10);
menuButtons();
page = 3;
}
// PAGE 4 - SETTINGS
void page4() {
screen.clrScr();
screen.print(" SETTINGS",RIGHT,10);
menuButtons();
screen.setFont(hallfetica_normal);
screen.print("SELECT PRIMARY COLOR: ", 20,20);
screen.print("SELECT DEFAULT SCREEN: ", 20,100);
page = 4;
}
void setup() {
extern uint8_t GroteskBold32x64[];
screen.InitLCD();
touch.InitTouch();
screen.clrScr();
screen.setFont(SmallFont);
touch.setPrecision(PREC_MEDIUM);
buttons.setTextFont(GroteskBold32x64);
buttons.setSymbolFont(Dingbats1_XL);
splash();
Serial.begin(9600);
// use Arduino pins
pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
delay(500);
}
void loop() {
screen.clrScr();
screen.setFont(BigFont);
//setButtonColors(Text,Inactive Button,Button Border, Button Pressed Border, Button Background)
buttons.setButtonColors(VGA_BLACK, VGA_GRAY, VGA_BLACK, VGA_WHITE, VGA_LIME);
menuButtons();
while(1)
{
if(touch.dataAvailable() == true)
{
pressed_button = buttons.checkButtons();
switch (pressed_button) {
case 0: page1();
break;
case 1: page2();
break;
case 2: page3();
break;
case 3: page4();
break;
}
}
}
}
Here are the errors I'm getting:
SmartStack.ino: In function ‘void splash()’:
SmartStack.ino:52:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:54:55: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino: In function ‘void menuButtons()’:
SmartStack.ino:62:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:63:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:64:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:65:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:92:28: error: no matching function for call to ‘UTFT::print(float&, int, int)’
SmartStack.ino:92:28: note: candidates are:
In file included from SmartStack.ino:3:0:
/home/jdlever/sketchbook/libraries/UTFT/UTFT.h:215:8: note: void UTFT::print(char*, int, int, int)
void print(char *st, int x, int y, int deg=0);
^
/home/jdlever/sketchbook/libraries/UTFT/UTFT.h:215:8: note: no known conversion for argument 1 from ‘float’ to ‘char*’
/home/jdlever/sketchbook/libraries/UTFT/UTFT.h:216:8: note: void UTFT::print(String, int, int, int)
void print(String st, int x, int y, int deg=0);
^
/home/jdlever/sketchbook/libraries/UTFT/UTFT.h:216:8: note: no known conversion for argument 1 from ‘float’ to ‘String’
SmartStack.ino:93:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:94:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:95:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino: In function ‘void page2()’:
SmartStack.ino:106:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:107:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:108:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:109:32: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:115:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:116:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:117:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:118:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino: In function ‘void page3()’:
SmartStack.ino:126:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino: In function ‘void page4()’:
SmartStack.ino:135:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:138:47: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
SmartStack.ino:139:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
I feel like I've tried everything and for the life of me can't get this #$@#$@#$@ thing to work!!!! DALGHLAHGLAHLGHAHLHAL!!!! Please Help!!