error using Serial Write String | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
error using Serial Write String
January 28, 2017
12:26 am
Avatar
David
Member
Forum Posts: 22
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Hello,

Brand new here.  I have used labview for many years buy just stumbled upon this site earlier this week and was really interested in trying LabVIEW with some physical hardware.  I'm using an RFduino (not officially supported, I know).  I mocked up a simple example reading and writing bytes via serial port.  Everything works fine if I use the Serial Write Bytes VI, but the compiler gives me the following error when trying to use the Serial Write String VI:

 

temp:58: error: 'class String' has no member named 'c_str'

_Serial[Node825Out]->write((unsigned char*)Const326.c_str(), Const326.length());

^

exit status 1
'class String' has no member named 'c_str'

 

I can wire a string constant to a String to Byte Array then to the Serial Write Bytes.  That compiles, loads, and runs as expected, so it's not something to do with simply having string data on the block diagram.  Since the string write obviously works with lots of other boards, is this an issue to do specifically with my hardware and configuration?   

As mentioned, I've worked with LabVIEW for years, but my debugging of text based languages and similar looking errors is very deficient (which is why I'm using LabVIEW, right??).  So if there's something related to the RFduino libraries or whatnot, I'm never going to solve it.  Rather than simply avoiding the string write function with this hardware, figured I might try to learn something.  Thanks for any help

January 28, 2017
12:58 am
Avatar
David
Member
Forum Posts: 22
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Well I managed to kind of answer my own question.. i.e. I was able to get it to work but without real understanding.  I found the string class in one of the library files for my board and replaced every instance of "cstr" with "c_str".  After that, my simple example compiles fine, but I suspect I'm going to have lots of similar type situations since compiling something nearly as simple like the 'Serial - Monitoring GUI - Arduino Target' VI gives a bunch of other errors.

January 28, 2017
1:27 am
Avatar
Steffan
Admin
Forum Posts: 304
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

The issue you are having is that you are using unsupported hardware which likely uses its own set of libraries for particular functions.  Here it looks like the String library is a little different, or non-standard from the Arduino String library.  Take a look here.  The Arduino Compatible Compiler for LabVIEW highly depends on some of the core Arduino libraries, including this StringObject library.  This is the WString library located at \Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino.  If your hardware is using some custom variant of this or other core libraries, then the ACC4LV will not compile code correctly and what you will see is the compiler errors returned from the Arduino C compiler.  This gives you a hint of what is going on as you found out, and you were able to resolve for c_str().  If you want to use unsupported hardware, you will have to dig through these libraries to see if you can resolve the issues by changing the libraries.  Otherwise you can refer to the product documentation for a list of boards that have been tested with the Compiler.

January 28, 2017
1:47 am
Avatar
David
Member
Forum Posts: 22
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

That was the conclusion I was coming too.  I happened to be at the store yesterday and just went with one of the cheapest options to see if I could get something to do something without too much trouble, which I'd rate as a success so far.  With that said, now I'm going to choose a supported board or maybe the PWS from here.  

Thanks for your advice!

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
6 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18

RTSLVU: 15

Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Geraldkix, ThomasSoogs, Angelvor, AngelaMuh, Nsneilohone

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89