So I’m really new here since it’s my first post.
After too many searches about tutorials about this decive I found a lot about writing to Arduino over this Bluetooth HC-06 device, but less about reading from it through the same way.
I can also say that I’m quite new with arduito either and its eletronic envolved.
So, what I’m pretending here is to read consistently data in time from my Arduino device into my windows 10 UWP app. I’ve tested a lot of samples that I’ve found around the web and the best I could get till now was an inconsistent response time.
Specifically, in my example, some responses come right in one second, and others take a lot more, maybe 10 or more seconds.
What I’m asking is, how quick can I write a char to my Arduino, get it with Serial.read() and after it within a switch case, returning a response back to my Windows App through the Serial.print(). Would say the perfect result I’m searching is maybe writing the message and reading it, all in one second, but if it is possible to do this with less time I would also want to know.
Till now I can make a solution that gives me the responses which I can work with but they are inconsistent in time. I want them faster and consistent in time.
So, I let you here the code that I upload to my Arduino as long as the code of my UWP sample.
Please see the code on my attached files ArduinoCode and UWPCode.
I’ve noticed already that sometimes the ReadAsync method runs two times to read the message because it is not complete. I can treat this concatenating the partial messages. But still, some times this second run of readAsync takes too long to be called and that’s the point I’m at and want to get rid of.
So, if you have a better solution for myself I would appretiate it, also if I’m doing something wrong here. Please tell me if what I’m pretending is possible with this device(HC-06) since my end objective is to read temperatures periodically within a second maybe and getting this temperatures to my App consistently. In fact I do not need them to be consistent, but I’d like too, to control the time interval to send the temperatures to be consistent.
By the way, I will make a sketch to Arduino that just prints the messages with some delay and see on the UWP app if it is consistent in time and the data it sends.
ArduinoCode.txt (394 Bytes)
UWPCode.txt (7.09 KB)