convert one sting into different char's

hello friends,

I have made a chess engine. This engine gives me a string of information of a move after i have made a move.

a sample of this information could be something like "e2e4". Which would mean that a piece has moved from the e2 square to the e4 square.

I am now trying to catagorize this information into 4 differnent chars, but i fail to do this on my own.

So really what i want is this:

  • I want the arduino to read the string of information
  • After that, i want the arduino to sort this string in 4 different chars:
  • And after that i want the arduino to give a sign that it has read the string succesfully.

Could anyone help me get here?

thanks in advnance!

Please post your code in tags.
Are you using Sting (uppercase S), or a C-sting char array[] ?

Have you the opportunity to formulate the message as e2,e4 - that would make the parsing easier. Have a look at the parse example in Serial Input Basics

What is the longest message that you will want to parse?

...R

I’m guessing but chessboard is 8x8 so 64 squares. And move would be one coordinate to another. So total of A-H and 1-8 to another.

How do the characters get into the Arduino?

Search Google to find "serial input basics" on this forum.