Hi, I got a problem. I receive a string (time in hh:mm:ss form from my DS3231 RTC library). In order to analyse time, I need to convert this string to three individual integers, I am using the following chunk of code (See below:). I've just started with this code but I am constantly getting error massage:
AVK_MATIC_T1_DUE.ino: In function 'void displayTime()':
AVK_MATIC_T1_DUE.ino:458:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
ISO C++ forbids comparison between pointer and integer [-fpermissive]
The error line is :
if (test != ":")
where I am basically looking for ":" sign that divide minutes, seconds and hours. Any suggestions on what am I doing wrong ? The board is DUE BTW.
The code:
void displayTime()
{
Serial.print(rtc.getDOWStr());
Serial.print(" ");
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
Serial.println(rtc.getTimeStr());
//CONVERT TIME FROM STRING TO INDIVIDUAL INTEGERS
String timeBuffer = (rtc.getTimeStr());
int timeLength = dateBuffer.length();
char test;
for (int n = 0; n <= timeLength; n = n + 1)
{
test = timeBuffer.charAt(n);
if (test != ":")
{
}
}
}