Hi, im sending one digit and one character from processing. E.g processing sends 1A or 1B, never more, never less than one digit + one character. I need to be able to send A-N from processing.
Arduino store the digit in 'char typeID; ' and the character in 'int motorID;'
This works but i need to convert the characters (in the motorID var) to numbers where A = 1, B=2… Which would be the easiest way of doing this?
This is how I receive the vars:
typeID = Serial.read(); // read it and store it in typeID
motorID = Serial.read(); // read it and store it in motorID
}
@CodingBadly,
I'm trying to follow along for learning purposes so I looked up the ASCII values for 'A' and '1' and the letters are = to '[num]'+0x30.
(ie: 1=0x31, A=0x61) so couldn't you just do 'A'-0x30 to convert 'A' to '1' ?