I have a serial device that I need to send a number as a string, i.e. “01” or “13” with the settings:
Baud rate 9600, Data bits 8, Parity None, Stop bits 1, flow control None.
When I send a message, the device doesn’t respond as I’d expect. However, if I use this software with those settings http://www.windmill.co.uk/serial.html
The device works as planned. However, here is the puzzle. When I run my OFW code and do exactly the same again (after running Windmill comDebug) it works perfectly.
Any ideas?
Its nothing to do with the device I’m using, but something to do with software or libraries.
I’ve discovered some weirdness with visual studio / serial connection.
you can download the latest version of the serial code (from the svn) or try changing this part of the setup code for VS (basically, we are avoiding all that “wide char” stuff using BuildCommDCBA)
#if (_MSC_VER) // microsoft visual studio
// msvc doesn't like BuildCommDCB,
//so we need to use this version: BuildCommDCBA
if(!BuildCommDCBA(buf,&cfg.dcb)){
printf("ofSerial: unable to build comm dcb; (%s) \n",buf);
}
#else
I noticed in NMM / sweden that this helped one VS user connect better with serial device.
I just downloaded the svn snapshot (link) and when I go to build, it says:
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(70) : error C2146: syntax error : missing ‘;’ before identifier ‘result’
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(71) : error C2143: syntax error : missing ‘;’ before ‘*’
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(72) : error C2143: syntax error : missing ‘;’ before ‘*’
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(72) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>…\libs\openFrameworks\sound\ofSoundPlayer.h(72) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I think perhaps you are not linked against fmodex properly. we’ve switched from fmod to fmodex.
hang tight, I am just fixing linux and we post shortly
sorry - we did some altering of core libraries (added glu, fmodex, etc) and so it’s not easy to just plug in the svn code. it will be after we get this up.
you can try just the new serial code (on the svn) and see if it helps
ah !!
you will need to add I think setupapi.lib to the build path… it’s a windows library you can find it with the other window.
sorry, sorry, lots of changes
I found 3 copies of setupapi.lib on my computer in…
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\AMD64\
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\IA64\
Which one is best to include? The first one I am guessing.
In the project settings, how should I be including this file?
you can just add into the list of libs that are being linked against.
be careful in VS, you will have to do this one at a time for “debug” and “release” targets, not for “all targets” – if you do it for all targets, you can clobber both list, because these list are actually different for debug/release because of rtAudio… there are description of doing this careful operation in the opencv addon. you don’t need to add that path (the first one) because it’s already set as part of the compiler (one of the steps in setting up VSEE).
I added
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\
in
Linker > General > Additional Library Directories
(for debug and release separately)
I still get the same build errors as before. Should it auto find setupapi.lib in that folder, or do I need to add setupapi.lib to the project properties somewhere?
cool - now can you let us know if that helps with the arduino interaction? We don’t get alot of chances to test that so feedback is helpful. This new code presents a better interface for querying for ports, opening ports, and interacting with the arduino.
please note that we’ve sometimes seen some arduinos take a pretty long time to sink (from uploading the code to then connecting and running it), so try to patient when you test –