8:07 pm
September 20, 2015
Hello everyone,
I’ve been using Arduino Compatible Compiler for LabVIEW with Arduino Nano and I am currently using version 10.0.0.21.
I tried to compile and upload to the Arduino a simple code with digital read/write nested into a while loop with coupled case structures and I got the following message:
1.0.0.21, Arduino Nano
temp.ino: In function 'void setup()':
temp.ino:103:40: error: 'Default' was not declared in this scope
temp.ino:147:40: error: 'Default' was not declared in this scope
How should I proceed to solve this issue?
Regards,
dan07.
7:14 pm
September 20, 2015
Steffan,
Sorry for the delay answering. I've been trying different approaches and I believe that I realized what the problem was.
The code has a Case Structure and the option Use default if unwired was activated for one of the tunnels. As long as I connected something to the tunnel and didn't use the Use default if unwired option anymore, the problem was gone.
Thanks for your help.
Daniel.
7:29 pm
March 12, 2015
Ah yes. This is item #5 of the FAQ in the user manual:
5) Why do I get a compilation error when I right click at a unwired Case Structure tunnel and select the LabVIEW option "Use Default if Unwired"?
The Arduino Compatible Compiler for LabVIEW currently does not support the "Use Default if Unwired" option for Case Structures. In order to avoid a compilation error, you will have to right click at the unwired tunnel and create a constant to be wired to the tunnel, as illustrated below.
3:35 pm
Hi. If I wire a string to case selector without any other terminals, I get a similar error that Default as not declared.
Please can you tell me what I am doing wrong? I have scanned the manuals, and can't find any reference to this.
I have attached / uploaded a simple VI "Test Case.vi" which demonstrates this.
Thanks
Alan K.
8:06 am
Many thanks Steffan.
Could I have found that in the manual somewhere?
On the topic of Case Structures, in the "Frequently Asked Questions" section of the manual, question 12) asks,
"Can I wire a string variable to the case selector terminal of a Case Structure?", and included in the reply is...
"It is recommended to use enumerated data types instead of string variables to wire to the case selector of a Case Structure."
So if I do a "Serial Read" of an incoming ASCII String, and want to execute different cases depending on the string, what is the best way to code this?
Thanks again for the great support.
Alan K.
10:24 pm
March 12, 2015
I don't think this one is in the manual. It is a corner case that LabVIEW allows for not setting a Default case whereas the converted Arduino C code requires a default case.
As far as a serial read with ASCII string, this is likely the best way to handle it, but you should always define a Default case. Just be aware that ever case will require storing the ASCII string in RAM. If you have a lot of cases this could take hundreds of bytes on an Arduino that only has 2k of RAM. This statement in the help manual is emphasizing if you have the option to use enum/numeric datatypes for a case structure because then each case of the case structure would only require likely 1 byte of RAM instead of many bytes for each case.
10
1 Guest(s)