user5133: Hey all I am trying to convert a string into a uint8_t with the following code:
String data = "#255101987";
String tmp1 = data.substring(1, 3);

uint8_t first  = (String)tmp1;

I am getting the error of:

cannot convert 'String' to 'uint8_t {aka unsigned char}' in initialization

Any help would be great as I thought adding (String) in front of the varible would solve the issue but it hasn't as you can tell.

user10794: uint8_t first  = atoi (tmp1.substring(1, 3).c_str ());   

Or even:
String data = "#255101987";
uint8_t first  = atoi (data.substring(1, 3).c_str ());   


5133: <p>Hey all I am trying to convert a string into a uint8_t with the following code:</p>

<pre><code>String data = "#255101987";
String tmp1 = data.substring(1, 3);

uint8_t first  = (String)tmp1;
</code></pre>

<p>I am getting the error of:</p>

<blockquote>
  <p>cannot convert 'String' to 'uint8_t {aka unsigned char}' in initialization</p>
</blockquote>

<p>Any help would be great as I thought adding <strong>(String)</strong> in front of the varible would solve the issue but it hasn't as you can tell.</p>
 10794: <pre><code>uint8_t first  = atoi (tmp1.substring(1, 3).c_str ());   
</code></pre>

<p>Or even:</p>

<pre><code>String data = "#255101987";
uint8_t first  = atoi (data.substring(1, 3).c_str ());   
</code></pre>
