Problem in decoding morse code

hello there,

  1. i am working on a project in which i have two radios ,with one radio i am transmitting morse code and another radio audio output i have given to arduino analog input.
  2. in morse decoder program i have made some changes as i am collecting all the incoming characters into a string of length 24.
  3. but every time i send the morse of 24 characters , i get different results
  4. even the first time count is not reaching 24 .
  5. i have attached the code and result of 5 times sending of morse code.
  6. the format in which i m sending morse is ".lat29.3784long089.6424." {without double inverted commas}

please help

thanks in advance

code.txt (4.3 KB)

result .txt (1.04 KB)

Without commenting on the rest of your code, this is wrong:

   y==0;

That does not assign zero to "y".

You also overflow

finstr[24]=0;
Serial.println(finstr);

You don't have a memory allocated for finstr[24] and you overwrite what's after which probably mess up everything.

Declare it with a size of 25 in you need this

Your png files are unreadable. Post the text instead.

  1. @ nick : plz see the att result.txt. if i dont declare y==0 before the for loop ,then the count starts from 1 itself ,eating up one full character.

  2. @ J -M -L : plz see the code,finstr has been declared as an array of 24 and in the end last character has been declared as null. so,,why does it over flow. now please check the reult.txt also.

  3. @ aarg : i have att result.txt . plz check and advice.

thank u all for ur help

nitish1448:

  1. @ nick : plz see the att result.txt. if i dont declare y==0 before the for loop ,then the count starts from 1 itself ,eating up one full character.

y==0 is not a declaration. It's also not an assignment. It's an expression, which doesn't change the value of y at all. What you almost certainly mean is y=0.

@nitish1448

yes it's an array of 24 so it ranges from 0 to 23. when you try to write

finstr[24]=0;

you write beyond your buffer limit

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Hi,

  1. @ nick : plz see the att result.txt. if i dont declare y==0 before the for loop ,then the count starts from 1 itself ,eating up one full character.

I think you missed the point. y=0 not y==0, you only use == when doing a comparison.

Tom.... :slight_smile:

What do you suppose will happen if you send at a rate that doesn't exactly equal 100 baud? Is your "fist" good enough to maintain that exact rate at all times? If that rate varies, how hard will it become to tell and 'A' from and 'R'?

please see the attached file result.txt
only problem is of first character being sent is missed every time.
rest baud rate and all is working fine