FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Are global variables supported on NXT?

I'm working on my FTC Auto code and I'm trying to make some SubVIs that watch the "Enabled" state of the robot.

Since these VIs have internal loops I expected that I could create a global variable for "Enabled" and use it in the SubVI.

But as soon as I put a Global Variable on my VI, I get the "Broken arrow".

When I expand the error description I'm just see my VI with an X next to it.  No details.

I tried looking the Advanced NXT documentation, but there is no mention Global Variables at all.

I guess I can try building a VI that reads and writes the Enabled state... but what a hassle!!!!

Have I missed something?

Phil

Get a life? This IS my life!
0 Kudos
Message 1 of 4
(4,602 Views)

Hi Phil,

Global Variables are currently not supported.  This isn't documented in the Advanced Programming guide because the LabVIEW compiler can catch this problem and break the run arrow.  I'm surprised you are not seeing an explanation in the error list.  This is what my error list window looks like when I drop a global variable. 

2009-12-15_120049.png

It looks like you'll have to use a VI to handle this state, also known as a functional global variable.

Cheers,

Mark

Mark
NI App Software R&D
0 Kudos
Message 2 of 4
(3,284 Views)

Hi Mark.

That error is because the global variable wasn't wired.

Try wiring it in and then checking the error.

If the VI is targeted to the computer, no error is shown, but when I target to the NXT I get the broken arrow with no specific error message.

Get a life? This IS my life!
0 Kudos
Message 3 of 4
(3,284 Views)

Phil,

Thanks for the additional information.  This is  a bug and I will be filing a report on this.

Thank you for bringing this to our attention.

Cheers,

Mark

Mark
NI App Software R&D
0 Kudos
Message 4 of 4
(3,284 Views)