Char and String Problem

Hi,

I have encountered a problem with declaration of the variables. This is my programme:

char UGVAction;

if( sendButton.isPressed() )
 {
   UGVAction = "Send";
   sendButton.ack();  
 }

 else if( returnButton.isPressed() )
 {
   UGVAction = "Return";
   returnButton.ack();
 }

The error states: " invalid conversion from 'const char*' to 'char' [-fpermissive]"
How do i solve this?

As said above.

You nearly got the posting of your code correct :wink: You can edit your post and replace the two occurrences of the word quote by code. So it looks like

code here

Minor difference but easier to read, easier to copy and no risk that e.g. [i] corrupts the presented code :wink:

I am confused with the declaration of array of Char. How do i declare the array of Char? I want to include if statements for the Char, therefore, there is no definite amount of characters. As stated in my programme, i want to include:

if( sendButton.isPressed() )
{UGVAction = "Send";}
if(returnButton.isPressed())
{UGVAction = "Return";}

Thanks.

I want to include if statements for the Char, therefore, there is no definite amount of characters.

You need to determine what the maximum number of characters will be, and size the array accordingly. You also need to learn how to copy data into an array. It is NOT done with an equal sign. strcpy() might prove useful. Or strcat().