NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » How to convert serial data from uart_read() to const char*

November 22, 2011
by saleem
saleem's Avatar

Hi,

I have a function as below "do_simple_display()" in it I am reading char using uart_read(). I want to call the function scroll_display(const char *s) how do I convert or make a string to pass to scroll_display() function?

Thx

Saleem

void do_simple_display() { ledarray_blank(); uint8_t offset = 0; char x = ' ';

while(1){ x = uart_read(); if(x == 'z'){ ledarray_blank(); offset = 0; } else { //render the charater we just got font_display(x,offset);

// I want to build my string here

  //adjust the offset for the next character
  offset += font_width(x)+1;
}

}

//then call scroll_display(my string) }

void scroll_display(const char *s) {

}

Post a Reply

Please log in to post a reply.

Did you know that an analog comparator can tell when one voltage input crosses another? Learn more...