rtc code error cannot convert 'char*' to 'int*'

Arduino: 1.8.5 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Users\Johan Prinsloo\Documents\Arduino\Clock_DUE\Clock_DUE.ino: In function 'void loop()':

Clock_DUE:73: error: cannot convert 'char*' to 'int*' for argument '1' to 'void printText(int*, uint16_t, int, int, int)'

printText(timeChar,WHITE,20,25,3);

^

Clock_DUE:75: error: invalid conversion from 'int' to 'int*' [-fpermissive]

printText(GREEN,8,5,1);

^

Clock_DUE:75: error: too few arguments to function 'void printText(int*, uint16_t, int, int, int)'

C:\Users\Johan Prinsloo\Documents\Arduino\Clock_DUE\Clock_DUE.ino:85:6: note: declared here

}void printText(int *text, uint16_t color, int x, int y,int textSize)//char *text

^

C:\Users\Johan Prinsloo\Documents\Arduino\Clock_DUE\Clock_DUE.ino: In function 'void printText(int*, uint16_t, int, int, int)':

Clock_DUE:92: error: call of overloaded 'print(int*&)' is ambiguous

tft.print(text);

^

C:\Users\Johan Prinsloo\Documents\Arduino\Clock_DUE\Clock_DUE.ino:92:17: note: candidates are:

In file included from C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Stream.h:26:0,

from C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/HardwareSerial.h:24,

from C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Arduino.h:195,

from sketch\Clock_DUE.ino.cpp:1:

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:61:12: note: size_t Print::print(char)

size_t print(char);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:61:12: note: no known conversion for argument 1 from 'int*' to 'char'

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:62:12: note: size_t Print::print(unsigned char, int)

size_t print(unsigned char, int = DEC);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:62:12: note: no known conversion for argument 1 from 'int*' to 'unsigned char'

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:63:12: note: size_t Print::print(int, int)

size_t print(int, int = DEC);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:63:12: note: no known conversion for argument 1 from 'int*' to 'int'

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:64:12: note: size_t Print::print(unsigned int, int)

size_t print(unsigned int, int = DEC);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:64:12: note: no known conversion for argument 1 from 'int*' to 'unsigned int'

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:65:12: note: size_t Print::print(long int, int)

size_t print(long, int = DEC);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:65:12: note: no known conversion for argument 1 from 'int*' to 'long int'

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:66:12: note: size_t Print::print(long unsigned int, int)

size_t print(unsigned long, int = DEC);

^

C:\Users\Johan Prinsloo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Print.h:66:12: note: no known conversion for argument 1 from 'int*' to 'long unsigned int'

exit status 1
cannot convert 'char*' to 'int*' for argument '1' to 'void printText(int*, uint16_t, int, int, int)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

#include  <Adafruit_GFX.h>
#include <Wire.h>
#include "Sodaq_DS3231.h"
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

#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

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


char timeChar[100];
char dateChar[50];
String dateString;
int minuteNow=0;
int minutePrevious=0;

void setup () 
{

    Serial.begin(57600);
    Wire.begin();
    rtc.begin();
    tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (2);  //0=PORTRAIT,1=LANDSCAPE 90 TURN,2=PORTRAIT_rev 180 TURN,3=LANDSCAPE_rev 270 TURN
  tft.fillScreen(LIGHTGREY);//Background color

}

void loop () 
{
  DateTime now = rtc.now(); //get the current date-time
  uint32_t ts = now.getEpoch();
  uint32_t old_ts;
    if (old_ts == 0 || old_ts != ts) {
         old_ts = ts;
  
  minuteNow = now.minute();
  if(minuteNow!=minutePrevious)
  {
    dateString = getDayOfWeek(now.dayOfWeek())+", ";
    dateString = dateString+String(now.date())+"/"+String(now.month());
    dateString= dateString+"/"+ String(now.year()); 
    minutePrevious = minuteNow;
    String hours = String(now.hour());
    if(now.minute()<10)
    {
      hours = hours+":0"+String(now.minute());
    }else
    {
      hours = hours+":"+String(now.minute());
    }
    
    hours.toCharArray(timeChar,100);
    printText(timeChar,WHITE,20,25,3);
    dateString.toCharArray(dateChar,50);
    printText(GREEN,8,5,1);
    
  }
    }
     }
  
void setRTCTime()
{
  DateTime dt(2015, 8, 27, 9, 35, 30, 4); // Year, Month, Day, Hour, Minutes, Seconds, Day of Week
  rtc.setDateTime(dt); //Adjust date-time as defined 'dt' above 
}void printText(int *text, uint16_t color, int x, int y,int textSize)//char *text

  {
  tft.setCursor(x, y);
  tft.setTextColor(color);
  tft.setTextSize(textSize);
  tft.setTextWrap(true);
  tft.print(text);
  }
String getDayOfWeek(int i)
{
  switch(i)
  {
    case 1: return "Monday";break;
    case 2: return "Tuesday";break;
    case 3: return "Wednesday";break;
    case 4: return "Thursday";break;
    case 5: return "Friday";break;
    case 6: return "Saturday";break;
    case 7: return "Sunday";break;
    default: return "Monday";break;
  }
}

Thanks in advance
Arduino DUE/ DS3231

printText needs 5 arguments, so that is one of the problems.

And it wants an array of integers for the first argument, not an array of characters.

Thanks but I'm unsure how to fix it. Can you please help me?

Thanks

First step would be to change this

void printText(int *text, uint16_t color, int x, int y,int textSize)

to

void printText(char *text, uint16_t color, int x, int y,int textSize)

Next check every call of that function.
E.g.

printText(GREEN,8,5,1);

You're not passing a text to be printed.

  tft.println(GREEN,8,5,1); [code]

like this?

fnb111:

  tft.println(GREEN,8,5,1); [code]

like this?

Is there a text to be printed now?

 tft.print (GREEN,8,5,1) [code]

I'm not sure if its a trick question.

sterretje:
Next check every call of that function.
E.g.

printText(GREEN,8,5,1);

You're not passing a text to be printed.

fnb111:

  tft.println(GREEN,8,5,1); [code]

like this?



[/code]

Again, where is the text you should add to that print (using printText, not println) ?

 hours.toCharArray(timeChar,100);     //print in WHITE
    tft.print(timeChar,WHITE,20,25,3);
    dateString.toCharArray(dateChar,50);    //print in GREEN
    tft.print(GREEN,8,5,1);

[code]

I gave you an example what to look for. It's not inside the printText function, it's where you use (call) the printText function.

PS
Just throwing code around does not make it easier for us to figure out what you don't understand.

I don't know how to fix it or what to look for so talking in riddles is not helping me at all. Thanks anyway for the help

You've just posted a piece of code with two different tft.print commands. The first one has 5 parameters and no errors but the second one only has 4 parameters. You need both of them to have the required 5 parameters.

You can't just leave a parameter out and hope that the compiler will guess what you mean.

Steve

fnb111:
I don't know how to fix it or what to look for so talking in riddles is not helping me at all. Thanks anyway for the help

In reply #3 I gave you an example of what was wrong. Search for that line in your code and fix it. Next look for similar lines and fix them.

I apologise if I wasn't clear enough; hope its now.

Thanks.
I left out the dateChar. Is it possible to change the code so it uses the pc time?

You already have an rtc; what do you want to do with the PC time?

Anyway, you need an application on the PC that can send the time to the board, e.g. using serial. And depending on the needs, that data can e.g. be used to set the time of the RTC.

I found this: