Go Down

Topic: USB Read/Write between Arduino and Ubuntu pc (Read 4 times) previous topic - next topic

marcus barnet


Quote
Now the problem is that Arduino is not able to recognize the commands sent by the C program: it always returns Error.

So you post the PC code. Why?


Because I thought the sketch is correct now since it manages the string correctly, so i posted the C code in order to receive some help on it.

May be, i'm not sending the commands in the correct way with my C code and someone can give me some suggestions.

In fact, to test it I added a println(myCmd) after the for loop in order to get back the string received and i noticed that Arduino receives just the "c" character of the whole string "check" sent my the C program.

C program sends "check"
Arduino receive "c" and then sends "Error".

Someone can help me on this problem, please?

marcus barnet

Arduino receives just the first character and then stops.


marcus barnet

I solved it!

Paul_S thanks for your help!!

PaulS

Quote
Paul_S thanks for your help!!

You're welcome.

Quote
I solved it!

Be nice to know how/what the problem was.

marcus barnet

Yes, the problem was in the C code with the libSerial write() function: i was sending just the first character of the buffer and not the other ones.

Now, i'll try to implement a communication protocol between C program and Arduino.

When i'll do this, can i post the C code and the Arduino sketch in order to see if it can be improved?

Or I have to post only the Arduino code?

Go Up