Split text into 'single' chars

Not sure if i’m on the right track with this… but any guidance is appreciated. Working with RTC and led cube. What i would eventually like to achieve is scrolling ‘worded time’. Already have a function to scroll text but the characters are fixed, predetermined and singular.

The following creates time in words (have snipped the ‘if’ and ‘case’ statements 1-12 for hrs and 1-59 for mins)

void setup() {

void loop(){

String finalString;

void createTextTime(int hh, int mm)// time data into text as one sentence
  finalString=finalString+"It is ";

  // now add the hour
  if (hh==1 || hh==13) { 
    finalString=finalString+"one "; 
  if (hh==2 || hh==14) { 
    finalString=finalString+"two "; 

    ... snip ...


  // now add the minutes
  case 1: 
    finalString=finalString+"oh one  "; 
  case 2:     
    finalString=finalString+"oh two  "; 

    ... snip ..

   case 59: 
    finalString=finalString+"fifty nine "; 

void effect_wordtime()
    DateTime now = RTC.now();

    int hh;
    hh = (now.hour()); 

    int mm;
    mm = (now.minute());

      createTextTime(int(hh),int(mm)); // convert the time into a sentence string
        // Serial.print(hh); 
        // Serial.print(":");
        // Serial.print(mm); 
        // Serial.println();

So while this code works great to serial monitor ‘It is five thirty nine’- is it possible to spilt the ‘finalString’ into ‘single letters’ and then somehow implement this into my scroll text funtion … snippet code …


const int charNum = 5; 
char string[charNum] = {'T','I','M','E',' '};

void effect_timeinwords(){

char font_data[128][8];
for (int ltr = 0; ltr < charNum; ltr++){// For each letter in string array
for(int dist = 0; dist < 8; dist++) { //bring letter forward

finalString will always be variable length of characters, as it is time.
cheers for your thoughts or putting me onto right track.

Hello again, Ok, what you will need to do is make your finalString into a char array. To do that, you will need to use strcpy(). Take a look at this link, it will help you. http://beej.us/guide/bgc/output/html/multipage/strcpy.html

Added: you can also do it like this. (Its basically the same thing) http://www.cplusplus.com/reference/cstring/strcat/

Hi, I'm not quite sure what you want to do. If you are using arduino after version 0019, then you can simply call finalString.charAt() have a look at the documentation here http://arduino.cc/en/Reference/StringObject

Thanks for the pointers thus far just reading up on.. before asking pertinent q's.

I'm not quite sure what you want to do.

one function creates the worded time as in 'its seven thirty''. the other function will then take this 'finalString' split into single letters and then display.

At the moment however the second function is predetermined eg

const int charNum = 5; 
char string[charNum] = {'T','I','M','E',' '};

letters T I M E are displayed on cube.

hope a little clearer in objective.

Not answering your problem, but instead of 60 case statements to select the text based on the minute number could you not use an array of char pointers indexed by the minute number ?