I have created an app on my Windows phone to send a message to my Makeblock Ultimate Kit via Bluetooth…
My code to send the message is very simple:
public async Task<uint> SendMessageAsync(string message)
{
uint sentMessageSize = 0;
if (writer != null)
{
uint messageSize = writer.MeasureString(message);
writer.WriteByte((byte)messageSize);
writer.WriteString(message);
await writer.StoreAsync();
sentMessageSize = 1;
}
return sentMessageSize;
}
Where the message is a string in the form of “a” or “b”
I have created the following code for reading the character…
if(bluetooth.available())
{
delay(10);
inDat = bluetooth.read();
Serial.println(inDat);
if (inDat == ‘a’)
{
motor3.run(motorSpeed);
motor4.run(motorSpeed);
}
else if(inDat = ‘b’)
{
motor3.stop();
motor4.stop();
}
}
When I look at the serial print out, I see strange characters like a y with two dots above it or a crazy looking q.
Any help?