How to make Serial.read() return an integer instead of an ascii value?
If it's a single digit:
if (t &gt;= '0' &amp;&amp; t &lt;= '9') {
    int numeric_value = t - '0';
} else {
    // Handle the input error.
}