There is no conversion. There is formatting for output but it's never really converted, since the Arduino (and most computers) can't store "A" but they can store binary numbers.
Or, more generally: to a computer (and for this, your Arduino counts as a computer), everything is a number.
Letters are numbers. Colors are numbers (or sets of numbers). All information takes the form of numbers.
Tools like the Arduino IDE allow you to pretend otherwise. They allow you to write things like digitalWrite(ledPin, HIGH); or Serial.println("Hello world!"); which then get translated into the appropriate sequence of numbers for your Arduino to process. The "text" which appears on your serial monitor is really just a sequence of numbers which, for your convenience, is displayed using shapes which you recognize as letters. (The letter shapes, too, are stored as numbers, in a font file in your PC. But I'm not going down that rabbit hole.)
And while we're on the subject of letters and numbers:
char series[2]; // you've declared series as an array
series = 'A'; // don't do this
series[0] = 'A'; // try this instead
series[1] = 0; // it's a good idea to null-terminate your character arrays
@Groove: I know you gave the same solution earlier, I just did not (and still don't) understand HOW it works, but it does give me the result I am looking for - thanks.
aisc:
Sorry but I cannot see how what u gave lets me achieve my objective.
Could you a clearer example?
It isn't entirely clear to me what your objective is, but my example pretty much covered what Whandall posted.
I think there's either some serious over-thinking or some under-thinking going on here
The letter A inside single quotes is a "character constant". That means that it is the programmer's representation of whatever number encodes the letter A. You actually don't need to know if this is 65 or 41 or 01000001. So if you are looking for some input to be an uppercase letter, you don't need to know if it's a particular number which is hard to remember, you only need to know that it falls somewhere between 'A' and 'Z'.
There are some useful tricks you can do with this. For example, if you have a single digit input and you need to convert this to an actual number instead of the ASCII code, you can do a simple subtraction:
int convertADigit(char digit) {
//convert a single digit to an integer - return negative one if it's not a digit.
if(digit >= '0' && digit <= '9') {
return digit - '0'; //convert ASCII code to an integer
} else {
return -1; //not a digit
}
}
I have no idea what the ASCII code for '0' is without looking it up but I don't need to: the compiler knows.
Groove:
It isn't entirely clear to me what your objective is, but my example pretty much covered what Whandall posted.
I think there's either some serious over-thinking or some under-thinking going on here
Why so grumpy?
You have been both acknowledged and thanked.
Although you offered a solution, given your example, I was not familiar enough with it to use it.
Whandall's example put it into a context that I could see how it applied to my code.