Pages: [1]   Go Down
Author Topic: Int to str.  (Read 404 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 29
Posts: 2441
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's what i need to do..

Code:
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 smiley-sad
//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.
Logged

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sprintf()
Logged

Offline Offline
Edison Member
*
Karma: 29
Posts: 2441
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

oh yeah, forgot all about that smiley - cheers
Logged

Pages: [1]   Go Up
Jump to: