Issue when trying to read from arduino hc-05
MichauCorp opened this issue · comments
hello, I will begin by saying I am quite new to cpp and coding, therefore this may not even seem like an issue to you.
i am trying to read from my device but all i get is the "warning, no delimiters found".
my code is just a while loop that reads from the port and prints it onto the console.
I don't really know what to do at this point, so I am asking you
thx in advance :)
Hello again, sorry for responding late. your response was really helpful, I simply put my message in between {} and my test program started to read it.
However now i am faced with a different problem.
The device i have connected to the program is an arduino device which acts as a sort of speedometer and will use "serial1" to send a string that will look something like this: {0.0,S} (speed and direction).
My problem is that when there are abrupt changes to the message (for example 0.0,S to 0.6,F) , there is a delay/pause in the values registering. it will take a few seconds stuck on (0.0,S) and then suddenly continue with the values changing accordingly to the current message.
My function:
int main()
{
char com_port[] = "\\.\COM6";
DWORD COM_BAUD_RATE = CBR_115200;
SimpleSerial Serial(com_port, COM_BAUD_RATE);
while (true)
{
string str = Serial.ReadSerialPort(7,"mine");
cout << str;
}
}
If you have any idea as to why that happens it would be a tremendous help to me.
Again, thx in advance.
Update: after reviewing it for a bit, i think it may be related to buffer size, so currently i am going to try increasing it