user68788: 
I have two characters, that I get by Bluetooth.
char a = SerialBT.read();
char b = SerialBT.read();

According to the Arduino Reference, decoded data stored in a char gets encoded to ASCII text.
I want to combine them in an Intenger, but the following methods don't work:
int c = a + b;


int c = (int)a + (int)b;


int c = (a - 48) + (b - 48);

and

String c;
c.setCharAt(0, a);
c.setCharAt(1, b);

Thank you

user68310: Use an AND mask to convert the character to a digit:
int c = 10 * (a & 0x0F) + (b & 0x0F);

When ASCII was invented, the digits 0 to 9 were encoded in hexadecimal as 30 to 39 to enable easy conversion to/from digits and characters.
To convert a digit to ASCII, OR the byte with 0x30:
byte digit = 5;
char character = digit | 0x30;

To convert a character to a digit, AND it with 0x0F:
char character = '5';
byte digit = character & 0x0F;

These logical operators are faster and more efficient than mathematical operations + and -.

user7508: OK, so after the lengthy requests for clarifications, it appears that
you are receiving a number in ASCII decimal ("12") and want to parse
it into an integer.
You may use the parseInt() method of the serial object, like:
int c = SerialBT.parseInt();

This can however make you program quite slow, as parseInt() uses a
timeout to know when to stop expecting more digits.
If you already have read the bytes, you can combine them with simple
arithmetics:
int c = 10 * (a - '0') + (b - '0');

Note that '0' is the same as 48, only it makes more explicit the
intent of your code.

68788: <br>
I have two characters, that I get by Bluetooth.
<pre><code>char a = SerialBT.read();
char b = SerialBT.read();
</code></pre>
<p>According to the <a href="https://www.arduino.cc/reference/en/language/variables/data-types/char/" rel="nofollow noreferrer">Arduino Reference</a>, decoded data stored in a char gets encoded to ASCII text.<br>
I want to combine them in an Intenger, but the following methods don't work:</p>
<pre><code>int c = a + b;
</code></pre>
<br>
<pre><code>int c = (int)a + (int)b;
</code></pre>
<br>
<pre><code>int c = (a - 48) + (b - 48);
</code></pre>
<p>and
<br></p>
<pre><code>String c;
c.setCharAt(0, a);
c.setCharAt(1, b);
</code></pre>
<p>Thank you</p>
 68310: <p>Use an AND mask to convert the character to a digit:</p>
<pre class="lang-c prettyprint-override"><code>int c = 10 * (a &amp; 0x0F) + (b &amp; 0x0F);
</code></pre>
<p>When ASCII was invented, the digits <code>0</code> to <code>9</code> were encoded in hexadecimal as <code>30</code> to <code>39</code> to enable easy conversion to/from digits and characters.</p>
<p>To convert a digit to ASCII, OR the byte with 0x30:</p>
<pre class="lang-c prettyprint-override"><code>byte digit = 5;
char character = digit | 0x30;
</code></pre>
<p>To convert a character to a digit, AND it with 0x0F:</p>
<pre class="lang-c prettyprint-override"><code>char character = '5';
byte digit = character &amp; 0x0F;
</code></pre>
<p>These logical operators are faster and more efficient than mathematical operations + and -.</p>
 7508: <p>OK, so after the lengthy requests for clarifications, it appears that
you are receiving a number in ASCII decimal (<code>&quot;12&quot;</code>) and want to parse
it into an integer.</p>
<p>You may use the <code>parseInt()</code> method of the serial object, like:</p>
<pre class="lang-cpp prettyprint-override"><code>int c = SerialBT.parseInt();
</code></pre>
<p>This can however make you program quite slow, as <code>parseInt()</code> uses a
timeout to know when to stop expecting more digits.</p>
<p>If you already have read the bytes, you can combine them with simple
arithmetics:</p>
<pre class="lang-cpp prettyprint-override"><code>int c = 10 * (a - '0') + (b - '0');
</code></pre>
<p>Note that <code>'0'</code> is the same as 48, only it makes more explicit the
intent of your code.</p>
