Chapter 8: C Pointers and Arrays
str[0] = s[3];
sendFString(ERROR_NUMBER);
60);
{
sendFString(ERROR_NUMBER);
char str[] = {0,0,'\0'};
r);
else
{
sendFString(ERROR_NUMBER);
str[1] = s[4];
sec = atoi(str);
if( sec <= 60)
{
gSECOND = (uint8_t)sec;
}
else
{
sendFString(ERROR_
}
}
void setMinute(char s[])
{
char str[] = {0,0,'\0'};
int min;
str[0] = s[3];
str[1] = s[4];
min = atoi(str);
if( min <= 60)
{
gMINUTE = (uint8_t)min;
}
else
sendFString(ERROR_60);
}
}
void setHour(char s[])
{
int hour;
str[0] = s[4];
str[1] = s[5];
hour = atoi(st
if( hour <= 12)
{
gHOUR = (uint8_t)hour;
}