Sending 2 string through serial port
I'm new with Qt. My problem is i don't know how to send multiple strings to serial port like :
QString data = "x" + "50" + " 60" ;
Does anyone who knows the answer, please ?
I would take
It can both send and read.
To send the data its simply
Yes, i read it but it can't get a right result, because i send a long string to arduino through serial. A string and convert to ascii
Here's my code :
int value_a=0, value_b=0;
QString a = ui->lineEdit_1->text();
for (int i = 0; i< a.length(); i++)
value_a = a.at(i).toLatin1();
for (int j = 0; j < b.length(); j++)
value_b = b.at(j).toLatin1();
QString data = "x" + value_a + value_b;
QByteArray buffer = data.toLatin1();
I assume you check that data contains what you expect.
You must explain what the issue is?
- get a right result
What is right result?
Is it on the arduino side?
Are you using ReadAll() ?
well, i will send "x" + "50" to serial , and in arduino will convert it , "x" is a character for starting and "50" is for data.
example : result = (data - 48)*100 + (data-48)*10 + data-48 - this is on arduino side.
The right result is 50 will be displayed oon LCD, i've checked on visual studio , everything on arduino is ok.
I'm not using ReadAll()
well U can test with the Terminal sample.
Try send from one to other and see what you get.
thanks for your help , my problem is solved
Super :) Please mark as Solved.