LCD Function for typewriter like typing.. HELP

Hi guys i want to write the welcoming message like a typewriter , i mean a delay between each char.
like this code

 lcd.print('H'); delay(10); lcd.print('e');delay(10); lcd.print('l');delay(10); lcd.print('l'); delay(10);lcd.print('o');delay(10);

i started to make my own function but i failed

void writer (char input[16] ) { 
  for (int i = 1; i <= 16; i++) {
   lcd.print( input[i]);

please help :frowning:

C arrays have zero-origin indexing, and so a sixteen element array has no index sixteen

you can try like this...

void typeWriter(char* text);

void setup() 
  typeWriter("Greetings from Arduino");
  typeWriter("Take Me To Your Leader");

void loop() 


void typeWriter(char* text)

Your code is heading in the right direction...

void writer (char *message) { 
  char *msgptr = &message;
  while (*msgptr) {

delay() is ok in this example, but if it was within a main loop(), you may prefer to call the writer function with millis() - so that nothing else is held up by the delay() calls.

NOT DOUBLE-CHECKED or TESTED, but the idea is there, and the code can be shortened once you understand how it works. You could also pass the interval as a second parameter in the function header. e.g.

void writer(char *message, char interval) { }

@lastchancename Why would you take the address of message. Message is already a pointer and you're taking the address where pointer is stored.


  char *msgptr = &message;


  char *msgptr = message;

Why would you take the address of message.

Why do you even need a copy of the pointer that was already passed?

reply #2

1 typo

2 I wanted to expand the example for OP to start using pointers

thanks for catching #1