How can "A0, D7" etc be integers?

@Rehaan, I know this code well. In this case, command is of type String and command.charAt(1) will extract a character of the command String and subtract the ascii value of ‘0’ from it. So if the extracted character is ‘7’ which has a decimal value of 55 and you subtract the decimal value of ascii ‘0’ which is 48, you get integer value 7! For the Spark, the pinNumber corresponding to pin 7 is one less than that, which explains the “-1”. :smile:

1 Like