Help for putting my String variable value to my char array

#include "cmap.h"
#include <Timer.h>

int d;
unsigned char char_pointer;
char Display_Ram[38];
unsigned char mask;

String message;
char LED_DATA[] = "00:00 ~";

boolean writing = false;

int cursor_pos = 4;

char count;	
unsigned char shift_counter;

#define INTEN 6000

const char CLK = 5; 
const char DAT = 6; 
const char STR = 7; 
const char K0 = A0; 
const char K1 = A1; 
const char K2 = A2; 
const char K3 = A3; 
const char K4 = 8; 
const char K5 = 9; 
const char K6 = 10; 
const char K7 = 11; 

void setup() {

  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  pinMode(CLK, OUTPUT);     
  pinMode(DAT, OUTPUT);     
  pinMode(STR, OUTPUT);     
  pinMode(K0, OUTPUT);     
  pinMode(K1, OUTPUT);     
  pinMode(K2, OUTPUT);     
  pinMode(K3, OUTPUT);     
  pinMode(K4, OUTPUT);     
  pinMode(K5, OUTPUT);     
  pinMode(K6, OUTPUT);     
  pinMode(K7, OUTPUT);  

  digitalWrite(K0,HIGH);  
  digitalWrite(K1,HIGH);  
  digitalWrite(K2,HIGH);  
  digitalWrite(K3,HIGH);  
  digitalWrite(K4,HIGH);  
  digitalWrite(K5,HIGH);  
  digitalWrite(K6,HIGH);  
  digitalWrite(K7,HIGH);  

  for(d=0;d<32;d++)
  {
    clock();
  }
  strobe();
  d = 0;
  
  Serial.println("\n\nTimer Console [Debug/Trace]");
  Serial.println();
  
  
}

void loop(){
    Write();
    Display();
    inputMaster();
}

void inputMaster()
{
    if (Serial.available() > 0) 
    {     
     char inputStr = Serial.read();
     
      if (cursor_pos == 4)
      {
        LED_DATA[4] = inputStr;
        cursor_pos--;
        Write();
      }
      else if (cursor_pos == 3)
      {
        LED_DATA[3] = inputStr;
        cursor_pos--;
        Write();
      }
      else if (cursor_pos == 2)
      {
         LED_DATA[1] = inputStr;
         cursor_pos--;
         Write();
      }
      else if (cursor_pos == 1)
      {
         LED_DATA[0] = inputStr;
         cursor_pos == 4;
         Write();  
      }
    }
}

void timer(void)
{
}

void Write(void)
{
    Display_Ram[1] = character_data[(LED_DATA[0] - 0x20)][0];
    Display_Ram[2] = character_data[(LED_DATA[0] - 0x20)][1];
    Display_Ram[3] = character_data[(LED_DATA[0] - 0x20)][2];
    Display_Ram[4] = character_data[(LED_DATA[0] - 0x20)][3];
    Display_Ram[5] = character_data[(LED_DATA[0] - 0x20)][4];
    Display_Ram[6] = 00;
    Display_Ram[7] = character_data[(LED_DATA[1] - 0x20)][0];
    Display_Ram[8] = character_data[(LED_DATA[1] - 0x20)][1];
    Display_Ram[9] = character_data[(LED_DATA[1] - 0x20)][2];
    Display_Ram[10] = character_data[(LED_DATA[1] - 0x20)][3];
    Display_Ram[11] = character_data[(LED_DATA[1] - 0x20)][4];
    Display_Ram[12] = 00;
    Display_Ram[13] = character_data[(LED_DATA[2] - 0x20)][0];
    Display_Ram[14] = character_data[(LED_DATA[2] - 0x20)][1];
    Display_Ram[15] = character_data[(LED_DATA[2] - 0x20)][2];
    Display_Ram[16] = character_data[(LED_DATA[2] - 0x20)][3];
    Display_Ram[17] = character_data[(LED_DATA[2] - 0x20)][4];
    Display_Ram[18] = 00;
    Display_Ram[19] = character_data[(LED_DATA[3] - 0x20)][0];
    Display_Ram[20] = character_data[(LED_DATA[3] - 0x20)][1];
    Display_Ram[21] = character_data[(LED_DATA[3] - 0x20)][2];
    Display_Ram[22] = character_data[(LED_DATA[3] - 0x20)][3];
    Display_Ram[23] = character_data[(LED_DATA[3] - 0x20)][4];
    Display_Ram[24] = 00;
    Display_Ram[25] = character_data[(LED_DATA[4] - 0x20)][0];
    Display_Ram[26] = character_data[(LED_DATA[4] - 0x20)][1];
    Display_Ram[27] = character_data[(LED_DATA[4] - 0x20)][2];
    Display_Ram[28] = character_data[(LED_DATA[4] - 0x20)][3];
    Display_Ram[29] = character_data[(LED_DATA[4] - 0x20)][4];
    Display_Ram[30] = 00;
    
}

void Display(void)
{
  //mask = 0x01;
  //scan();
  //digitalWrite(K7,LOW);
  //for(d=0;d<INTEN;d++){}
  //digitalWrite(K7,HIGH);

  mask = 0x02;
  scan();
  digitalWrite(K6,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K6,HIGH);

  mask = 0x04;
  scan();
  digitalWrite(K5,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K5,HIGH);

  mask = 0x08;
  scan();
  digitalWrite(K4,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K4,HIGH);

  mask = 0x10;
  scan();
  digitalWrite(K3,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K3,HIGH);

  mask = 0x20;
  scan();
  digitalWrite(K2,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K2,HIGH);

  mask = 0x40;
  scan();
  digitalWrite(K1,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K1,HIGH);

  mask = 0x80;
  scan();
  digitalWrite(K0,LOW);
  for(d=0;d<INTEN;d++){}
  digitalWrite(K0,HIGH);
}

void load(void){
  char counter1;
  if(LED_DATA[char_pointer+1] == '~')
    char_pointer = 0;
  for(counter1 = 0; counter1 < 5; counter1++){
    Display_Ram[32 + counter1] = character_data[(LED_DATA[char_pointer] - 0x20)][counter1];
  }
  //--------------------------//
  Display_Ram[37] = 00;	
  char_pointer++;
}

void Clear_Display_Ram(void){
  unsigned char rcount;
  for(rcount = 0; rcount < 37; rcount++)
    Display_Ram[rcount] = 0xff;
}

void scan(void){
  for (count=32;count>(-1);count--){
    if ((Display_Ram[count] & mask) == mask)
      digitalWrite(DAT,LOW);
    else
      digitalWrite(DAT,HIGH);
    clock();
  }
  strobe();
}

void clock(void){
  digitalWrite(CLK,HIGH);			// clock hi
  digitalWrite(CLK,LOW);		        // clock low
}

void strobe(void){
  digitalWrite(STR,HIGH);			// strobe hi
  digitalWrite(STR,LOW);			// strobe low
}

I want to display my String message by using this technique…

String timerDisplay;
LED_DATA[] = char(timerDisplay); //this Variable is a char array that is used for displaying characters on my LED MATRIX…

but it gives me this error… invalid cast from type ‘String’ to type ‘char’
I am programming a countdown timer using a ATmega1281 and displays it on a LED MATRIX 8x8x4

char LED_DATA[] = "00:00 ~";

This is a string also, it's a C string, not to be confused with a String object.

There is a 8x8 dot matrix library called LedControl, that allows strings to be scrolled across the display.

Give it a try.

I want to display my String message by using this technique...

Pigs want to fly, too, but that is no more realistic than your expectation that you can cast a String to a char. A collection of characters wrapped in a String instance can NOT be cast to a single character, no matter how much you might wish that it could.

The String class has a toCharArray() that gets the uselessly wrapped collection of characters from the useless wrapper as an array of characters. Which is what you really need. You do not cast that array to anything. You do NOT need to piss resources away on Strings.

PaulS:

Pigs want to fly, too, but that is no more realistic than your expectation that you can cast a String to a char.

XD I know that my technique is so so so far away from reality, so i am looking for another solution that function same as mine. LOL :D

Perhaps you can give me a sample code. Anyways i'll take a look on what you are saying.

Perhaps you can give me a sample code.

String useless = "This is a waste of resources";

char buffer[80];
int bufSiz = sizeof(buffer) / sizeof(buffer[0]);

useless.ToCharArray(buffer, bufSiz-1);

Then, you can pass buffer to the LedControl method that expects you to be smart enough to supply a char array.