parsing string is not working

I’m creating a very simple visual morse code generator using an UNO.
Everything works correctly, except for the “parseString” loop.
Any help would be appreciated.

Thank you

VisualMorseCode.ino (2.1 KB)

I'd like to help, but i can't see your code

Any help would be appreciated.

I don’t think you want to “parse” the text actually, you simply seem to want t to loop through all letters of a given text and then send the letters in Morse code.

A couple of days ago I posted a similar code in the German (“Deutsch”) forum section.

The German guy had the special requirement, that he wanted to send the dits (short pulses) on a different LED pin than the dahs (long pulses).

This is the code I posted for him:

const byte ditPin=12;
const byte dahPin=13;
#define DIT 100
#define DAH 3*DIT
#define PAUSE 2*DIT

void dit()
{ // function playing a short dit/dot

void dah()

void setup()

void sendMorse(char* text)
  for(int i=0;i<strlen(text);i++)
    char c=text[i];
      case 'S':dit();dit();dit();delay(PAUSE);break;
      case 'O':dah();dah();dah();delay(PAUSE);break;
      case ' ':delay(2*PAUSE);break;

void loop()
  sendMorse("SOS ");


Do you understand how it works?

Currently only uppercase letter 'S, uppercase letter ‘O’ and are implemented and space characters are implemented as “pause between words”.

BTW: The sendMorse() function does NOT take a “string object” as its parameter, but the parameter is is a pointer to a char array. That’s how the C language deals with text: char arrays and char array pointers, NOT “String” objects.

In case you want to change the signal sending, you just have to change the dit() and dah() functions.
Please feel free to ask in case you have any questions about the code.

@AWOL - the code is in an attachment. Look for the paperclip and click on the link to download the code.

Take a look at the documentation for substring. The second parameter specifies the end of the substring but is not included. rather than i,i try i,i+1. String indexes start at 0 too, not one.

timc_fla: @AWOL - the code is in an attachment

Why? Why isn't it posted in code tags, so that those of us on mobile devices can see it?

(I know what attachments are, but thanks for the explanation)