Go Down

Topic: Int to str. (Read 508 times) previous topic - next topic

cjdelphi

Here's what i need to do..

Code: [Select]

byte h,m,s;
  h = RTC.get(DS1307_HR,true);  //12
  m = RTC.get(DS1307_MIN,true); //55
  s = RTC.get(DS1307_SEC,true);  //


char TimeStr[6] //store values here
int LenOfStr;

TimeStr = h + " : " + M + ":" + S;
LenOfStr = Length(TimeStr);
Serial.println(TimeStr);  //12:55:0
Serial.println(LenOfStr);

//Above code wont compile, but that's the result i'm looking for, char arrays C ctyle :(
//but - I need to know the exact length of the string

I need to convert Hours, Minutes and Seconds  into a char string, i've been trying atoi and itoa.

Arrch


cjdelphi

oh yeah, forgot all about that :) - cheers

Go Up