0

i have a value q that is int and can arrive only in range of 0 - 9. and i have the sending function that needs a char value to work. i need to convert the q to char value and send it.

the code im using there:

int q = 5;

//need to convert q to char c
//typicaly like so 'q'
//

Write(c,'!');

if im using something like that c[1] = '\(q)'; i getting error from arduino app:

invalid conversion from 'char*' to 'char' [-fpermissive]

so how can i solve it?

2 Answers 2

1

Try this:

char c;
int q = 5;

c = q + '0'; // convert the number to a character corresponding to it
Sign up to request clarification or add additional context in comments.

Comments

0

Write((char)q, '!'). Sounds like very simple question or maybe I have not understood it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.