user8524: I'm trying to send data from an Arduino to an Android device.
I saw an online guide for that which provided this code:
void setup() 
{ 
  Serial.begin(115200);
} 

void loop() 
{ 
  byte msg[64]; 
  int len = Serial.available();
  if (len > 0)
  {
    len = Serial.readBytes((char*)msg, sizeof(msg)); // readBytes seems to need a char* not a byte*
    Serial.write(msg, len);
  }
}  

I tried that example and it is working perfectly!
But when I put Serial.write("3");
in the setup loop after Serial.begin(115200);
it appears as question mark on my Android device,
I guess that I'm not sending it as a byte,
I searched online but without any luck.

user10907: Start by changing it to Serial.write("3", 1);
Does that help, you're missing the second parameter to the Serial.write call, which is the number of characters (bytes) to write. 

8524: <p>I'm trying to send data from an Arduino to an Android device.</p>

<p>I saw an online guide for that which provided this code:</p>

<pre class="lang-c prettyprint-override"><code>void setup() 
{ 
  Serial.begin(115200);
} 

void loop() 
{ 
  byte msg[64]; 
  int len = Serial.available();
  if (len &gt; 0)
  {
    len = Serial.readBytes((char*)msg, sizeof(msg)); // readBytes seems to need a char* not a byte*
    Serial.write(msg, len);
  }
}  
</code></pre>

<p>I tried that example and it is working perfectly!</p>

<p>But when I put <code>Serial.write("3");</code>
in the setup loop after <code>Serial.begin(115200);</code>
it appears as question mark on my Android device,
I guess that I'm not sending it as a byte,
I searched online but without any luck.</p>
 10907: <p>Start by changing it to <code>Serial.write("3", 1);</code></p>

<p>Does that help, you're missing the second parameter to the Serial.write call, which is the number of characters (bytes) to write. </p>
