i got a problem with serial communication from arduino to pc. i have written a short c++ program, that is reading the serial port (i'm using Qt together with Qtextserial). The strange thing is: When I connect the arduino and then run the arduino IDE serial monitor, then close the monitor again (so the port is open), my program will work and show correct data. When i plug in the arduino and start my program without having used the serial monitor of the IDE before, i get crap data: ie. "ww[ch8592][ch8616]www", instead of "hello".
maybe someone had similar problems before and could help me?
It sounds like you are not setting all the attributes of the serial object the same as the Arduino expects. Once the Serial Monitor has initialized the port correctly, your application is then able to read the port data.
Post some code, so we can see what you are doing or not doing.
I tried to load the library, etc, but no luck .. just getting going with QT and it is a bit over my skills with that environment.
If you have details on where to load the library files and can provide the complete app source / product that can be run, then I may be able to help debug it. Would be nice to get this going.
For me .. all else failed and I had to revert to other environments, which was too bad since QT sure seems great in many ways.
I can't provide the whole source code. So far I could not solve the problem. I use Qt 4.6.2 under winXP (i must use XP..)
If i can get my hands on any other serial hardware device I'll try it aswell.. had no luck with arduino so far.
I programmed now a C# program which translates serial to open sound control, which is nice anyway No problems there with serial.. For Qt I adapted oscpack (from audiomulch) which is working very well as an open sound control library.
Keep you posted on this.. maybe boost.serial library will work fine with Qt..