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);
}
}
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.