Getting 2 String from keypad and convert in time

Hi , i'm new in arduino and I really need help in my code and thank you so much
// I need to generat 2 string from keypad and put them in A and B the probleme I have that B take always the value of A and I want It to take Also value from keypas not the same .
// I need to generate B in time i don't know how to change float or integer to time
(I wille compare it latter with DS3231 so i will make it in the same category (time) )

String A;
String B ;

char X1;
char X2;

int i=0;
int j=0;

void setup() {
lcd.init();
lcd.backlight();
 }

void loop() {
if (key) {
    if (IsNumber(key))
    {
      ProcessNumber(key);
    }
}
bool IsNumber(char key)
{
  if(key >= '0' && key <= '9')
   return true;
   return false;
}
void ProcessNumber(char key)
{

 lcd.setCursor(0,1);
 if(X1 == ' ')
    i++;
    A+= key;   
    lcd.print(A);  
       

    lcd.setCursor(6,1);
 if(X2 == ' ')
    j++;
    B+= key; 
    lcd.print(B);
float Z = B.toInt();

Please post the entire sketch. What do you mean, "in time"? That could mean hundreds of different things.

I wille compare it latter with DS3231 so i will make it in the same category (time) ;

There are also hundreds of ways to express time. Please be more specific. First, one comment. It makes absolutely no sense to represent time internally to your program in a 'float' data type.

for exemple : while( strcmp(rtc.getTimeStr(), "00:00:15")<=0)
in my exemple this value "00:00:15" is Z that that is generate from keypad it will be somthing like this in the end :
while( strcmp(rtc.getTimeStr(), Z) <=0)

Saw it coming... post your entire sketch!!!!!!!! reply #2...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.