// verify "type" can contain the values
char chars[] = {"753"}; // ASCII
byte charlen = sizeof(chars) / sizeof(chars[0]) - 1; // length of chars[] minus <CR>
long accumulator; // accumulator
void setup() {
Serial.begin(115200);
for (byte i = 0; i < charlen; i++) { // count through characters
long digit = chars[i] - 48; // change ASCII to INT
int power = charlen - i - 1; // local variable
digit = digit * placevalue(power); // digit * 10 ^ place
accumulator += digit; // add result of digit * 10 ^ place
}
Serial.print("result ");
Serial.println(accumulator);
}
void loop() {}
long placevalue(int exponent) {
long power = 1; // reset local power
for (int i = 0; i < exponent; i++) { // count backwards 3, 2, 1
power *= 10; // accumulate the exponents
}
return (power);
}